COLLECTED BY
Organization:
Internet Archive
Focused crawls are collections of frequently-updated webcrawl data from narrow (as opposed to broad or wide) web crawls, often focused on a single domain or subdomain.
The Wayback Machine - https://web.archive.org/web/20201220220430/https://github.com/lodash/lodash/blob/master/create.js
Permalink
Cannot retrieve contributors at this time
39 lines (38 sloc)
975 Bytes
/**
* Creates an object that inherits from the `prototype` object. If a
* `properties` object is given, its own enumerable string keyed properties
* are assigned to the created object.
*
* @since 2.3.0
* @category Object
* @param {Object } prototype The object to inherit from.
* @param {Object } [properties] The properties to assign to the object.
* @returns {Object } Returns the new object.
* @example
*
* function Shape() {
* this.x = 0
* this.y = 0
* }
*
* function Circle() {
* Shape.call(this)
* }
*
* Circle.prototype = create(Shape.prototype, {
* 'constructor': Circle
* })
*
* const circle = new Circle
* circle instanceof Circle
* // => true
*
* circle instanceof Shape
* // => true
*/
function create ( prototype , properties ) {
prototype = prototype === null ? null : Object ( prototype )
const result = Object . create ( prototype )
return properties == null ? result : Object . assign ( result , properties )
}
export default create
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.