[d24f17c] | 1 | /**
|
---|
| 2 | * Utility function that works like `Object.apply`, but copies getters and setters properly as well. Additionally gives
|
---|
| 3 | * the option to exclude properties by name.
|
---|
| 4 | */
|
---|
| 5 | export declare const copyProps: (dest: object, src: object, exclude?: string[]) => void;
|
---|
| 6 | /**
|
---|
| 7 | * Returns the full chain of prototypes up until Object.prototype given a starting object. The order of prototypes will
|
---|
| 8 | * be closest to farthest in the chain.
|
---|
| 9 | */
|
---|
| 10 | export declare const protoChain: (obj: object, currentChain?: object[]) => object[];
|
---|
| 11 | /**
|
---|
| 12 | * Identifies the nearest ancestor common to all the given objects in their prototype chains. For most unrelated
|
---|
| 13 | * objects, this function should return Object.prototype.
|
---|
| 14 | */
|
---|
| 15 | export declare const nearestCommonProto: (...objs: object[]) => object | undefined;
|
---|
| 16 | /**
|
---|
| 17 | * Creates a new prototype object that is a mixture of the given prototypes. The mixing is achieved by first
|
---|
| 18 | * identifying the nearest common ancestor and using it as the prototype for a new object. Then all properties/methods
|
---|
| 19 | * downstream of this prototype (ONLY downstream) are copied into the new object.
|
---|
| 20 | *
|
---|
| 21 | * The resulting prototype is more performant than softMixProtos(...), as well as ES5 compatible. However, it's not as
|
---|
| 22 | * flexible as updates to the source prototypes aren't captured by the mixed result. See softMixProtos for why you may
|
---|
| 23 | * want to use that instead.
|
---|
| 24 | */
|
---|
| 25 | export declare const hardMixProtos: (ingredients: any[], constructor: Function | null, exclude?: string[]) => object;
|
---|
| 26 | export declare const unique: <T>(arr: T[]) => T[];
|
---|
| 27 | export declare const flatten: <T>(arr: T[][]) => T[];
|
---|