summaryrefslogtreecommitdiff
path: root/node_modules/ts-mixer/dist/esm/util.d.ts
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2023-09-02 19:12:47 -0400
committersowgro <tpoke.ferrari@gmail.com>2023-09-02 19:12:47 -0400
commite4450c8417624b71d779cb4f41692538f9165e10 (patch)
treeb70826542223ecdf8a7a259f61b0a1abb8a217d8 /node_modules/ts-mixer/dist/esm/util.d.ts
downloadsowbot3-e4450c8417624b71d779cb4f41692538f9165e10.tar.gz
sowbot3-e4450c8417624b71d779cb4f41692538f9165e10.tar.bz2
sowbot3-e4450c8417624b71d779cb4f41692538f9165e10.zip
first commit
Diffstat (limited to 'node_modules/ts-mixer/dist/esm/util.d.ts')
-rw-r--r--node_modules/ts-mixer/dist/esm/util.d.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/node_modules/ts-mixer/dist/esm/util.d.ts b/node_modules/ts-mixer/dist/esm/util.d.ts
new file mode 100644
index 0000000..4797ef4
--- /dev/null
+++ b/node_modules/ts-mixer/dist/esm/util.d.ts
@@ -0,0 +1,27 @@
+/**
+ * Utility function that works like `Object.apply`, but copies getters and setters properly as well. Additionally gives
+ * the option to exclude properties by name.
+ */
+export declare const copyProps: (dest: object, src: object, exclude?: string[]) => void;
+/**
+ * Returns the full chain of prototypes up until Object.prototype given a starting object. The order of prototypes will
+ * be closest to farthest in the chain.
+ */
+export declare const protoChain: (obj: object, currentChain?: object[]) => object[];
+/**
+ * Identifies the nearest ancestor common to all the given objects in their prototype chains. For most unrelated
+ * objects, this function should return Object.prototype.
+ */
+export declare const nearestCommonProto: (...objs: object[]) => object | undefined;
+/**
+ * Creates a new prototype object that is a mixture of the given prototypes. The mixing is achieved by first
+ * identifying the nearest common ancestor and using it as the prototype for a new object. Then all properties/methods
+ * downstream of this prototype (ONLY downstream) are copied into the new object.
+ *
+ * The resulting prototype is more performant than softMixProtos(...), as well as ES5 compatible. However, it's not as
+ * flexible as updates to the source prototypes aren't captured by the mixed result. See softMixProtos for why you may
+ * want to use that instead.
+ */
+export declare const hardMixProtos: (ingredients: any[], constructor: Function | null, exclude?: string[]) => object;
+export declare const unique: <T>(arr: T[]) => T[];
+export declare const flatten: <T>(arr: T[][]) => T[];