source: node_modules/ts-mixer/dist/esm/util.d.ts

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.6 KB
Line 
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 */
5export 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 */
10export 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 */
15export 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 */
25export declare const hardMixProtos: (ingredients: any[], constructor: Function | null, exclude?: string[]) => object;
26export declare const unique: <T>(arr: T[]) => T[];
27export declare const flatten: <T>(arr: T[][]) => T[];
Note: See TracBrowser for help on using the repository browser.