@newdash/newdash
Version:
javascript/typescript utility library
35 lines (34 loc) • 820 B
TypeScript
/**
* 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
*/
declare function create(prototype: any, properties: any): any;
export default create;