Comparing version 5.9.4 to 5.9.5
@@ -16,3 +16,3 @@ <a name="Enmap"></a> | ||
* [.db](#enmap-db-database) ⇒ <code>Database</code> | ||
* [.autonum](#enmap-autonum-string) ⇒ <code>string</code> | ||
* [.autonum](#enmap-autonum-number) ⇒ <code>number</code> | ||
* [.set(key, val, path)](#enmap-set-key-val-path-enmap) ⇒ [<code>Enmap</code>] | ||
@@ -23,3 +23,3 @@ * [.update(key, valueOrFunction)](#enmap-update-key-valueorfunction) | ||
* [.fetchEverything()](#enmap-fetcheverything-enmap) ⇒ [<code>Enmap</code>] | ||
* [.fetch(keyOrArrayOfKeys)](#enmap-fetch-keyorarrayofkeys-enmap-enmap-or) ⇒ [<code>Enmap</code>](#enmap-map) \| <code>\*</code> | ||
* [.fetch(keyOrKeys)](#enmap-fetch-keyorkeys-enmap-enmap-or) ⇒ [<code>Enmap</code>](#enmap-map) \| <code>\*</code> | ||
* [.evict(keyOrArrayOfKeys)](#enmap-evict-keyorarrayofkeys-enmap) ⇒ [<code>Enmap</code>] | ||
@@ -43,3 +43,3 @@ * [.changed(cb)](#enmap-changed-cb) | ||
* [.array()](#enmap-array-array) ⇒ <code>Array</code> | ||
* [.keyArray()](#enmap-keyarray-array-less-than-string-greater-than) ⇒ <code>Array.<string></code> | ||
* [.keyArray()](#enmap-keyarray-array-less-than-string-or-number-greater-than) ⇒ <code>Array.<(string\|number)></code> | ||
* [.random([count])](#enmap-random-count-or-array-less-than-greater-than) ⇒ <code>\*</code> \| <code>Array.<\*></code> | ||
@@ -133,3 +133,3 @@ * [.randomKey([count])](#enmap-randomkey-count-or-array-less-than-greater-than) ⇒ <code>\*</code> \| <code>Array.<\*></code> | ||
### enmap.autonum ⇒ <code>string</code> | ||
### enmap.autonum ⇒ <code>number</code> | ||
Generates an automatic numerical key for inserting a new value. | ||
@@ -141,3 +141,3 @@ This is a "weak" method, it ensures the value isn't duplicated, but does not | ||
**Kind**: instance property of [<code>Enmap</code>](#enmap-map) | ||
**Returns**: <code>string</code> - The generated key number. | ||
**Returns**: <code>number</code> - The generated key number. | ||
**Example** | ||
@@ -238,3 +238,3 @@ ```js | ||
| --- | --- | --- | --- | | ||
| key | <code>string</code> | | The key to retrieve from the enmap. | | ||
| key | <code>\*</code> | | The key to retrieve from the enmap. | | ||
| path | <code>string</code> | <code>null</code> | Optional. The property to retrieve from the object or array. | | ||
@@ -251,3 +251,3 @@ | ||
### enmap.fetch(keyOrArrayOfKeys) ⇒ [<code>Enmap</code>](#enmap-map) \| <code>\*</code> | ||
### enmap.fetch(keyOrKeys) ⇒ [<code>Enmap</code>](#enmap-map) \| <code>\*</code> | ||
Force fetch one or more key values from the enmap. If the database has changed, that new value is used. | ||
@@ -260,3 +260,3 @@ | ||
| --- | --- | --- | | ||
| keyOrArrayOfKeys | <code>string</code> \| <code>Array.<string></code> | A single key or array of keys to force fetch from the enmap database. | | ||
| keyOrKeys | <code>string</code> \| <code>number</code> \| <code>Array.<(string\|number)></code> | A single key or array of keys to force fetch from the enmap database. | | ||
@@ -273,3 +273,3 @@ <a name="Enmap+evict"></a> | ||
| --- | --- | --- | | ||
| keyOrArrayOfKeys | <code>string</code> \| <code>Array.<string></code> | A single key or array of keys to remove from the cache. | | ||
| keyOrArrayOfKeys | <code>string</code> \| <code>number</code> \| <code>Array.<(string\|number)></code> | A single key or array of keys to remove from the cache. | | ||
@@ -313,3 +313,3 @@ <a name="Enmap+changed"></a> | ||
| --- | --- | --- | --- | | ||
| key | <code>string</code> | | Required. The key of the array element to push to in Enmap. | | ||
| key | <code>string</code> | | Required. The key of the array element to push to in Enmap. This value MUST be a string or number. | | ||
| val | <code>\*</code> | | Required. The value to push to the array. | | ||
@@ -433,3 +433,3 @@ | path | <code>string</code> | <code>null</code> | Optional. The path to the property to modify inside the value object or array. Can be a path with dot notation, such as "prop1.subprop2.subprop3" | | ||
| --- | --- | --- | --- | | ||
| key | <code>string</code> | | Required. The key of the element to add to The Enmap or array. | | ||
| key | <code>string</code> | | Required. The key of the element to add to The Enmap or array. This value MUST be a string or number. | | ||
| path | <code>string</code> | <code>null</code> | Optional. The property to verify inside the value object or array. Can be a path with dot notation, such as "prop1.subprop2.subprop3" | | ||
@@ -505,3 +505,3 @@ | ||
| --- | --- | --- | --- | | ||
| key | <code>string</code> | | Required. The key of the element to remove from in Enmap. | | ||
| key | <code>string</code> | | Required. The key of the element to remove from in Enmap. This value MUST be a string or number. | | ||
| val | <code>\*</code> \| <code>function</code> | | Required. The value to remove from the array or object. OR a function to match an object. If using a function, the function provides the object value and must return a boolean that's true for the object you want to remove. | | ||
@@ -546,2 +546,5 @@ | path | <code>string</code> | <code>null</code> | Optional. The name of the array property to remove from. Can be a path with dot notation, such as "prop1.subprop2.subprop3". If not presents, removes directly from the value. | | ||
Creates an ordered array of the values of this Enmap. | ||
The array will only be reconstructed if an item is added to or removed from the Enmap, | ||
or if you change the length of the array itself. If you don't want this caching behaviour, | ||
use `Array.from(enmap.values())` instead. | ||
@@ -551,4 +554,7 @@ **Kind**: instance method of [<code>Enmap</code>](#enmap-map) | ||
### enmap.keyArray() ⇒ <code>Array.<string></code> | ||
### enmap.keyArray() ⇒ <code>Array.<(string\|number)></code> | ||
Creates an ordered array of the keys of this Enmap | ||
The array will only be reconstructed if an item is added to or removed from the Enmap, | ||
or if you change the length of the array itself. If you don't want this caching behaviour, | ||
use `Array.from(enmap.keys())` instead. | ||
@@ -614,3 +620,3 @@ **Kind**: instance method of [<code>Enmap</code>](#enmap-map) | ||
| propOrFn | <code>string</code> \| <code>function</code> | The property to test against, or the function to test with | | ||
| [value] | <code>\*</code> | The expected value - only applicable and required if using a property for the first argument. Can't be nil. | | ||
| [value] | <code>\*</code> | The expected value - only applicable and required if using a property for the first argument | | ||
@@ -815,3 +821,3 @@ **Example** | ||
| --- | --- | --- | | ||
| key | <code>string</code> | Required. The key of the element to add to The Enmap or array. | | ||
| key | <code>string</code> | Required. The key of the element to add to The Enmap or array. This value MUST be a string or number. | | ||
| path | <code>string</code> | Required. The property to modify inside the value object or array. Can be a path with dot notation, such as "prop1.subprop2.subprop3" | | ||
@@ -833,3 +839,3 @@ | val | <code>\*</code> | Required. The value to apply to the specified property. | | ||
| --- | --- | --- | --- | | ||
| key | <code>string</code> | | Required. The key of the element. | | ||
| key | <code>string</code> | | Required. The key of the element. This value MUST be a string or number. | | ||
| path | <code>string</code> | | Required. The name of the array property to push to. Can be a path with dot notation, such as "prop1.subprop2.subprop3" | | ||
@@ -884,3 +890,3 @@ | val | <code>\*</code> | | Required. The value push to the array property. | | ||
| --- | --- | --- | | ||
| key | <code>string</code> | Required. The key of the element. | | ||
| key | <code>string</code> | Required. The key of the element. This value MUST be a string or number. | | ||
| path | <code>string</code> | Required. The name of the array property to remove from. Can be a path with dot notation, such as "prop1.subprop2.subprop3" | | ||
@@ -887,0 +893,0 @@ | val | <code>\*</code> | Required. The value to remove from the array property. | |
{ | ||
"name": "enmap", | ||
"version": "5.9.4", | ||
"version": "5.9.5", | ||
"description": "A simple database wrapper to make sqlite database interactions much easier for beginners, with additional array helper methods.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -63,6 +63,6 @@ declare module 'enmap' { | ||
* Hack to work around TypeScript's structural integrity requirement. | ||
* This is the Map<string, V> class without the delete method since Enmap returns this | ||
* This is the Map<K, V> class without the delete method since Enmap returns this | ||
* while the standard returns boolean. | ||
*/ | ||
class AlmostMap<V> { | ||
class AlmostMap<K, V> { | ||
readonly size: number; | ||
@@ -73,15 +73,15 @@ readonly [Symbol.toStringTag]: 'Map'; | ||
forEach( | ||
callbackfn: (value: V, key: string, map: Map<string, V>) => void, | ||
callbackfn: (value: V, key: K, map: Map<K, V>) => void, | ||
thisArg?: any, | ||
): void; | ||
get(key: string): V | undefined; | ||
has(key: string): boolean; | ||
set(key: string, value: V): this; | ||
get(key: K): V | undefined; | ||
has(key: K): boolean; | ||
set(key: K, value: V): this; | ||
entries(): IterableIterator<[string, V]>; | ||
keys(): IterableIterator<string>; | ||
entries(): IterableIterator<[K, V]>; | ||
keys(): IterableIterator<K>; | ||
values(): IterableIterator<V>; | ||
[Symbol.iterator](): IterableIterator<[string, V]>; | ||
[Symbol.iterator](): IterableIterator<[K, V]>; | ||
} | ||
@@ -94,5 +94,6 @@ | ||
export default class Enmap< | ||
K extends string | number = string | number, | ||
V = any, | ||
SV = unknown, | ||
> extends AlmostMap<V> { | ||
> extends AlmostMap<K, V> { | ||
public readonly cloneLevel: 'none' | 'shallow' | 'deep'; | ||
@@ -112,3 +113,3 @@ public readonly name: string; | ||
public readonly changedCB: ( | ||
key: string, | ||
key: K, | ||
oldValue: V | undefined, | ||
@@ -118,2 +119,3 @@ newValue: V | undefined, | ||
private db: any; | ||
private pool: any; | ||
@@ -135,9 +137,2 @@ private ready: () => void; | ||
/** | ||
* Get the better-sqlite3 database object. Useful if you want to directly query or interact with the | ||
* underlying SQLite database. Use at your own risk, as errors here might cause loss of data or corruption! | ||
* @return {Database} | ||
*/ | ||
public readonly db: any; | ||
/** | ||
* Generates an automatic numerical key for inserting a new value. | ||
@@ -149,5 +144,5 @@ * This is a "weak" method, it ensures the value isn't duplicated, but does not | ||
* enmap.set(enmap.autonum, "This is a new value"); | ||
* @return The generated key string. | ||
* @return The generated key number. | ||
*/ | ||
public readonly autonum: string; | ||
public readonly autonum: number; | ||
@@ -172,3 +167,3 @@ /** | ||
constructor( | ||
iterable?: Iterable<[string, V]> | string | EnmapOptions<V, SV>, | ||
iterable?: Iterable<[K, V]> | string | EnmapOptions<V, SV>, | ||
options?: EnmapOptions<V, SV>, | ||
@@ -192,3 +187,3 @@ ); | ||
*/ | ||
public set(key: string, val: V): this; | ||
public set(key: K, val: V): this; | ||
@@ -208,3 +203,3 @@ /** | ||
*/ | ||
public set(key: string, val: any, path: string): this; | ||
public set(key: K, val: any, path: string): this; | ||
@@ -223,3 +218,3 @@ /** | ||
*/ | ||
public update(key: string, valueOrFunction: V | ((value: V) => V)): V; | ||
public update(key: K, valueOrFunction: V | ((value: V) => V)): V; | ||
@@ -238,21 +233,8 @@ /** | ||
*/ | ||
public get(key: string): V | undefined; | ||
public get<P extends keyof V>(key: string, path: P): V[P] | undefined; | ||
public get<P extends Path<V>>( | ||
key: string, | ||
path: P, | ||
): PathValue<V, P> | undefined; | ||
public get(key: string, path: string): unknown; | ||
public get(key: K): V | undefined; | ||
public get<P extends keyof V>(key: K, path: P): V[P] | undefined; | ||
public get<P extends Path<V>>(key: K, path: P): PathValue<V, P> | undefined; | ||
public get(key: K, path: string): unknown; | ||
/** | ||
* Returns an observable object. Modifying this object or any of its properties/indexes/children | ||
* will automatically save those changes into enmap. This only works on | ||
* objects and arrays, not "basic" values like strings or integers. | ||
* @param {*} key The key to retrieve from the enmap. | ||
* @param {string} path Optional. The property to retrieve from the object or array. | ||
* @return {*} The value for this key. | ||
*/ | ||
public observe(key: string, path?: string): V | undefined; | ||
/** | ||
* Fetches every key from the persistent enmap and loads them into the current enmap value. | ||
@@ -268,3 +250,3 @@ * @return The enmap containing all values. | ||
*/ | ||
public fetch(keys: string[]): this; | ||
public fetch(keys: K[]): this; | ||
@@ -276,3 +258,3 @@ /** | ||
*/ | ||
public fetch(key: string): V; | ||
public fetch(key: K): V; | ||
@@ -284,3 +266,3 @@ /** | ||
*/ | ||
public evict(keyOrArrayOfKeys: string | string[]): this; | ||
public evict(keyOrArrayOfKeys: K | K[]): this; | ||
@@ -297,7 +279,3 @@ /** | ||
public changed( | ||
cb: ( | ||
key: string, | ||
oldValue: V | undefined, | ||
newValue: V | undefined, | ||
) => void, | ||
cb: (key: K, oldValue: V | undefined, newValue: V | undefined) => void, | ||
): void; | ||
@@ -317,2 +295,3 @@ | ||
* @param key Required. The key of the element to add to The Enmap or array. | ||
* This value MUST be a string or number. | ||
* @param path Required. The property to modify inside the value object or array. | ||
@@ -323,3 +302,3 @@ * Can be a path with dot notation, such as "prop1.subprop2.subprop3" | ||
*/ | ||
public setProp(key: string, path: string, val: any): this; | ||
public setProp(key: K, path: string, val: any): this; | ||
@@ -329,2 +308,3 @@ /** | ||
* @param key Required. The key of the array element to push to in Enmap. | ||
* This value MUST be a string or number. | ||
* @param val Required. The value to push to the array. | ||
@@ -343,8 +323,3 @@ * @param path Optional. The path to the property to modify inside the value object or array. | ||
*/ | ||
public push( | ||
key: string, | ||
val: any, | ||
path?: string, | ||
allowDupes?: boolean, | ||
): this; | ||
public push(key: K, val: any, path?: string, allowDupes?: boolean): this; | ||
@@ -354,2 +329,3 @@ /** | ||
* @param key Required. The key of the element. | ||
* This value MUST be a string or number. | ||
* @param path Required. The name of the array property to push to. | ||
@@ -361,8 +337,3 @@ * Can be a path with dot notation, such as "prop1.subprop2.subprop3" | ||
*/ | ||
public pushIn( | ||
key: string, | ||
path: string, | ||
val: any, | ||
allowDupes?: boolean, | ||
): this; | ||
public pushIn(key: K, path: string, val: any, allowDupes?: boolean): this; | ||
@@ -391,3 +362,3 @@ // AWESOME MATHEMATICAL METHODS | ||
public math( | ||
key: string, | ||
key: K, | ||
operation: MathOps, | ||
@@ -411,3 +382,3 @@ operand: number, | ||
*/ | ||
public inc(key: string, path?: string): this; | ||
public inc(key: K, path?: string): this; | ||
@@ -427,3 +398,3 @@ /** | ||
*/ | ||
public dec(key: string, path?: string): this; | ||
public dec(key: K, path?: string): this; | ||
@@ -437,3 +408,3 @@ /** | ||
*/ | ||
public getProp(key: string, path: string): any; | ||
public getProp(key: K, path: string): any; | ||
@@ -458,3 +429,3 @@ /** | ||
*/ | ||
public ensure(key: string, defaultValue: V, path?: string): V; | ||
public ensure(key: K, defaultValue: V, path?: string): V; | ||
@@ -466,2 +437,3 @@ /* BOOLEAN METHODS THAT CHECKS FOR THINGS IN ENMAP */ | ||
* @param key Required. The key of the element to add to The Enmap or array. | ||
* This value MUST be a string or number. | ||
* @param path Optional. The property to verify inside the value object or array. | ||
@@ -476,16 +448,5 @@ * Can be a path with dot notation, such as "prop1.subprop2.subprop3" | ||
*/ | ||
public has(key: string, path?: string): boolean; | ||
public has(key: K, path?: string): boolean; | ||
/** | ||
* Performs Array.includes() on a certain enmap value. Works similar to | ||
* [Array.includes()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes). | ||
* @param {string} key Required. The key of the array to check the value of. | ||
* @param {string|number} val Required. The value to check whether it's in the array. | ||
* @param {string} path Optional. The property to access the array inside the value object or array. | ||
* Can be a path with dot notation, such as "prop1.subprop2.subprop3" | ||
* @return {boolean} Whether the array contains the value. | ||
*/ | ||
public includes(key: string, val: V, path?: string): boolean; | ||
/** | ||
* Returns whether or not the property exists within an object or array value in enmap. | ||
@@ -497,3 +458,3 @@ * @param key Required. The key of the element to check in the Enmap or array. | ||
*/ | ||
public hasProp(key: string, path: string): boolean; | ||
public hasProp(key: K, path: string): boolean; | ||
@@ -508,3 +469,3 @@ /** | ||
*/ | ||
public delete(key: string, path?: string): this; | ||
public delete(key: K, path?: string): this; | ||
@@ -517,24 +478,9 @@ /** | ||
*/ | ||
public deleteProp(key: string, path: string): void; | ||
public deleteProp(key: K, path: string): void; | ||
/** | ||
* Deletes everything from the enmap. If persistent, clears the database of all its data for this table. | ||
* THIS ACTION WILL DELETE YOUR DATA AND CANNOT BE UNDONE. | ||
* @returns {void} | ||
*/ | ||
public deleteAll(): void; | ||
/** | ||
* Completely destroys the entire enmap. This deletes the database tables entirely. | ||
* It will not affect other enmap data in the same database, however. | ||
* THIS ACTION WILL DESTROY YOUR DATA AND CANNOT BE UNDONE. | ||
* @returns {null} | ||
*/ | ||
public destroy(): null; | ||
/** | ||
* Deletes everything from the enmap. If persistent, clears the database of all its data for this table. | ||
* THIS ACTION WILL DELETE YOUR DATA AND CANNOT BE UNDONE. | ||
* @returns {void} | ||
*/ | ||
public clear(): void; | ||
@@ -546,2 +492,3 @@ | ||
* @param key Required. The key of the element to remove from in Enmap. | ||
* This value MUST be a string or number. | ||
* @param val Required. The value to remove from the array or object. | ||
@@ -553,3 +500,3 @@ * @param path Optional. The name of the array property to remove from. | ||
*/ | ||
public remove(key: string, val: V, path?: string): this; | ||
public remove(key: K, val: V, path?: string): this; | ||
@@ -560,2 +507,3 @@ /** | ||
* @param key Required. The key of the element. | ||
* This value MUST be a string or number. | ||
* @param path Required. The name of the array property to remove from. | ||
@@ -566,3 +514,3 @@ * Can be a path with dot notation, such as "prop1.subprop2.subprop3" | ||
*/ | ||
public removeFrom(key: string, path: string, val: any): this; | ||
public removeFrom(key: K, path: string, val: any): this; | ||
@@ -599,6 +547,6 @@ /** | ||
*/ | ||
public static multi<V, SV>( | ||
public static multi<K extends string | number, V, SV>( | ||
names: string[], | ||
options?: EnmapOptions<V, SV>, | ||
): Enmap<V>[]; | ||
): Enmap<K, V>[]; | ||
@@ -608,3 +556,3 @@ /* INTERNAL (Private) METHODS */ | ||
/** | ||
* INTERNAL METHOD. Initializes the enmap depending on given values. | ||
* Internal Method. Initializes the enmap depending on given values. | ||
* @param pool In order to set data to the Enmap, one must be provided. | ||
@@ -616,31 +564,3 @@ * @returns Returns the defer promise to await the ready state. | ||
/** | ||
* INTERNAL METHOD. Checks if the key or array of keys is valid. | ||
* Will THROW AN ERROR if the key is neither a string nor an array of strings. | ||
* @param {string|Array<string>} keys The key(s) to check. | ||
*/ | ||
private _checkKeyOrArrayOfKeys(keys: string): void; | ||
/** | ||
* INTERNAL METHOD. Checks if the key is a valid string. | ||
* Will THROW AN ERROR if the key is not a string. | ||
* @param {string} key The key to check. | ||
*/ | ||
private _checkKey(key: string): void; | ||
/** | ||
* INTERNAL METHOD. Checks if the array of keys is valid. | ||
* Will THROW AN ERROR if the key is not an array of strings. | ||
* @param {Array<string>} keys The keys to check. | ||
*/ | ||
private _checkArrayOfKeys(keys: Array<string>); | ||
/** | ||
* INTERNAL METHOD. Checks if the property is of valid type. | ||
* Will THROW AN ERROR if the property is not a strings. | ||
* @param {string} prop The property to check. | ||
*/ | ||
private _checkProp(prop: string): void; | ||
/** | ||
* INTERNAL METHOD to verify the type of a key or property | ||
* INTERNAL method to verify the type of a key or property | ||
* Will THROW AN ERROR on wrong type, to simplify code. | ||
@@ -651,6 +571,6 @@ * @param key Required. The key of the element to check | ||
*/ | ||
private _check(key: string, type: string, path?: string): void; | ||
private _check(key: K, type: string, path?: string): void; | ||
/** | ||
* INTERNAL METHOD to execute a mathematical operation. Cuz... javascript. | ||
* INTERNAL method to execute a mathematical operation. Cuz... javascript. | ||
* And I didn't want to import mathjs! | ||
@@ -665,3 +585,3 @@ * @param base the lefthand operand. | ||
/** | ||
* INTERNAL METHOD used to validate persistent enmap names (valid Windows filenames) | ||
* Internal method used to validate persistent enmap names (valid Windows filenames) | ||
*/ | ||
@@ -671,10 +591,10 @@ private _validateName(): void; | ||
/** | ||
* INTERNAL METHOD. Verifies if a key needs to be fetched from the database. | ||
* Internal Method. Verifies if a key needs to be fetched from the database. | ||
* If persistent enmap and autoFetch is on, retrieves the key. | ||
* @param key The key to check or fetch. | ||
*/ | ||
private _fetchCheck(key: string, force?: boolean): void; | ||
private _fetchCheck(key: K, force?: boolean): void; | ||
/** | ||
* INTERNAL METHOD. Parses JSON data. | ||
* Internal Method. Parses JSON data. | ||
* Reserved for future use (logical checking) | ||
@@ -687,3 +607,3 @@ * @param data The data to check/parse | ||
/** | ||
* INTERNAL METHOD. Clones a value or object with the enmap's set clone level. | ||
* Internal Method. Clones a value or object with the enmap's set clone level. | ||
* @param data The data to clone. | ||
@@ -695,3 +615,3 @@ * @return The cloned value. | ||
/** | ||
* INTERNAL METHOD. Verifies that the database is ready, assuming persistence is used. | ||
* Internal Method. Verifies that the database is ready, assuming persistence is used. | ||
*/ | ||
@@ -711,3 +631,5 @@ private _readyCheck(): void; | ||
* Creates an ordered array of the values of this Enmap. | ||
* @return {Array<V>} The values of this Enmap. | ||
* The array will only be reconstructed if an item is added to or removed from the Enmap, | ||
* or if you change the length of the array itself. If you don't want this caching behavior, | ||
* use `Array.from(enmap.values())` instead. | ||
*/ | ||
@@ -718,5 +640,7 @@ public array(): V[]; | ||
* Creates an ordered array of the keys of this Enmap | ||
* @return {Array<string>} The keys of this Enmap. | ||
* The array will only be reconstructed if an item is added to or removed from the Enmap, | ||
* or if you change the length of the array itself. If you don't want this caching behavior, | ||
* use `Array.from(enmap.keys())` instead. | ||
*/ | ||
public keyArray(): string[]; | ||
public keyArray(): K[]; | ||
@@ -740,3 +664,3 @@ /** | ||
*/ | ||
public randomKey(): string; | ||
public randomKey(): K; | ||
@@ -769,5 +693,3 @@ /** | ||
*/ | ||
public find( | ||
fn: (val: V, key: string, enmap: this) => boolean, | ||
): V | undefined; | ||
public find(fn: (val: V, key: K, enmap: this) => boolean): V | undefined; | ||
@@ -794,5 +716,3 @@ /** | ||
*/ | ||
public findKey( | ||
fn: (val: V, key: string, enmap: this) => boolean, | ||
): string | undefined; | ||
public findKey(fn: (val: V, key: K, enmap: this) => boolean): K | undefined; | ||
/** | ||
@@ -806,3 +726,3 @@ * Searches for the key of a single item where its specified property's value is identical to the given value | ||
*/ | ||
public findKey(prop: string, value: any): string | undefined; | ||
public findKey(prop: string, value: any): K | undefined; | ||
@@ -830,3 +750,3 @@ /** | ||
public sweep( | ||
fn: (val: V, key: string, enmap: this) => boolean, | ||
fn: (val: V, key: K, enmap: this) => boolean, | ||
thisArg?: any, | ||
@@ -842,3 +762,3 @@ ): number; | ||
public filter( | ||
fn: (val: V, key: string, enmap: this) => boolean, | ||
fn: (val: V, key: K, enmap: this) => boolean, | ||
thisArg?: any, | ||
@@ -854,3 +774,3 @@ ): this; | ||
public filterArray( | ||
fn: (val: V, key: string, enmap: this) => boolean, | ||
fn: (val: V, key: K, enmap: this) => boolean, | ||
thisArg?: any, | ||
@@ -868,3 +788,3 @@ ): V[]; | ||
public partition( | ||
fn: (val: V, key: string, enmap: this) => boolean, | ||
fn: (val: V, key: K, enmap: this) => boolean, | ||
thisArg?: any, | ||
@@ -879,6 +799,3 @@ ): [Enmap, Enmap]; | ||
*/ | ||
public map<R>( | ||
fn: (val: V, key: string, enmap: this) => R, | ||
thisArg?: any, | ||
): R[]; | ||
public map<R>(fn: (val: V, key: K, enmap: this) => R, thisArg?: any): R[]; | ||
@@ -892,3 +809,3 @@ /** | ||
public some( | ||
fn: (val: V, key: string, enmap: this) => boolean, | ||
fn: (val: V, key: K, enmap: this) => boolean, | ||
thisArg?: any, | ||
@@ -904,3 +821,3 @@ ): boolean; | ||
public every( | ||
fn: (val: V, key: string, enmap: this) => boolean, | ||
fn: (val: V, key: K, enmap: this) => boolean, | ||
thisArg?: any, | ||
@@ -916,3 +833,3 @@ ): boolean; | ||
public reduce( | ||
fn: (acc: V, val: V, key: string, enmap: this) => V, | ||
fn: (acc: V, val: V, key: K, enmap: this) => V, | ||
initialValue?: V, | ||
@@ -928,3 +845,3 @@ ): V; | ||
public reduce<R>( | ||
fn: (acc: R, val: V, key: string, enmap: this) => V, | ||
fn: (acc: R, val: V, key: K, enmap: this) => V, | ||
initialValue: R, | ||
@@ -938,3 +855,3 @@ ): R; | ||
*/ | ||
public clone(): Enmap<V, SV>; | ||
public clone(): Enmap<K, V>; | ||
@@ -947,3 +864,3 @@ /** | ||
*/ | ||
public concat(...enmaps: Enmap<V, SV>[]): Enmap<V, SV>; | ||
public concat(...enmaps: Enmap<K, V>[]): Enmap<K, V>; | ||
@@ -957,4 +874,4 @@ /** | ||
*/ | ||
public equals(enmap: Enmap<V>): boolean; | ||
public equals(enmap: Enmap<K, V>): boolean; | ||
} | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3432841
16035