@bemoje/map 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +414 -108
- package/lib/index.d.cts +364 -17
- package/lib/index.d.ts +364 -17
- package/lib/index.js +400 -15
- package/package.json +81 -141
- package/lib/ExtMap.cjs +0 -104
- package/lib/ExtMap.d.cts +0 -110
- package/lib/ExtMap.d.ts +0 -110
- package/lib/ExtMap.js +0 -101
- package/lib/TimeoutWeakMap.cjs +0 -120
- package/lib/TimeoutWeakMap.d.cts +0 -75
- package/lib/TimeoutWeakMap.d.ts +0 -75
- package/lib/TimeoutWeakMap.js +0 -118
- package/lib/countUniques.cjs +0 -18
- package/lib/countUniques.d.cts +0 -9
- package/lib/countUniques.d.ts +0 -9
- package/lib/countUniques.js +0 -15
- package/lib/entriesArray.cjs +0 -10
- package/lib/entriesArray.d.cts +0 -19
- package/lib/entriesArray.d.ts +0 -19
- package/lib/entriesArray.js +0 -8
- package/lib/isGenericMap.cjs +0 -16
- package/lib/isGenericMap.d.cts +0 -6
- package/lib/isGenericMap.d.ts +0 -6
- package/lib/isGenericMap.js +0 -14
- package/lib/keysArray.cjs +0 -10
- package/lib/keysArray.d.cts +0 -19
- package/lib/keysArray.d.ts +0 -19
- package/lib/keysArray.js +0 -8
- package/lib/mapGetOrDefault.cjs +0 -16
- package/lib/mapGetOrDefault.d.cts +0 -8
- package/lib/mapGetOrDefault.d.ts +0 -8
- package/lib/mapGetOrDefault.js +0 -14
- package/lib/mapLoad.cjs +0 -13
- package/lib/mapLoad.d.cts +0 -11
- package/lib/mapLoad.d.ts +0 -11
- package/lib/mapLoad.js +0 -11
- package/lib/mapReverse.cjs +0 -15
- package/lib/mapReverse.d.cts +0 -15
- package/lib/mapReverse.d.ts +0 -15
- package/lib/mapReverse.js +0 -12
- package/lib/mapUpdate.cjs +0 -12
- package/lib/mapUpdate.d.cts +0 -13
- package/lib/mapUpdate.d.ts +0 -13
- package/lib/mapUpdate.js +0 -10
- package/lib/sort.cjs +0 -15
- package/lib/sort.d.cts +0 -25
- package/lib/sort.d.ts +0 -25
- package/lib/sort.js +0 -13
- package/lib/sortByKeys.cjs +0 -17
- package/lib/sortByKeys.d.cts +0 -24
- package/lib/sortByKeys.d.ts +0 -24
- package/lib/sortByKeys.js +0 -15
- package/lib/sortByValues.cjs +0 -17
- package/lib/sortByValues.d.cts +0 -25
- package/lib/sortByValues.d.ts +0 -25
- package/lib/sortByValues.js +0 -15
- package/lib/toMap.cjs +0 -10
- package/lib/toMap.d.cts +0 -20
- package/lib/toMap.d.ts +0 -20
- package/lib/toMap.js +0 -8
- package/lib/valuesArray.cjs +0 -10
- package/lib/valuesArray.d.cts +0 -19
- package/lib/valuesArray.d.ts +0 -19
- package/lib/valuesArray.js +0 -8
package/lib/keysArray.d.cts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns an array of all keys in the map.
|
|
5
|
-
* Convenience method that converts the keys iterator to an array.
|
|
6
|
-
*
|
|
7
|
-
* @returns Array of all keys
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* const map = new ExtMap<string, number>()
|
|
12
|
-
* .load([['a', 1], ['b', 2], ['c', 3]])
|
|
13
|
-
*
|
|
14
|
-
* console.log(keysArray(map)) // ['a', 'b', 'c']
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
declare function keysArray<K, V>(ins: GenericMap<K, V, 'keys'>): K[];
|
|
18
|
-
|
|
19
|
-
export { keysArray };
|
package/lib/keysArray.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns an array of all keys in the map.
|
|
5
|
-
* Convenience method that converts the keys iterator to an array.
|
|
6
|
-
*
|
|
7
|
-
* @returns Array of all keys
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* const map = new ExtMap<string, number>()
|
|
12
|
-
* .load([['a', 1], ['b', 2], ['c', 3]])
|
|
13
|
-
*
|
|
14
|
-
* console.log(keysArray(map)) // ['a', 'b', 'c']
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
declare function keysArray<K, V>(ins: GenericMap<K, V, 'keys'>): K[];
|
|
18
|
-
|
|
19
|
-
export { keysArray };
|
package/lib/keysArray.js
DELETED
package/lib/mapGetOrDefault.cjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
function mapGetOrDefault(map, key, factory) {
|
|
6
|
-
let value = map.get(key);
|
|
7
|
-
if (value !== void 0 || map.has(key)) {
|
|
8
|
-
return value;
|
|
9
|
-
}
|
|
10
|
-
value = factory(key, map);
|
|
11
|
-
map.set(key, value);
|
|
12
|
-
return value;
|
|
13
|
-
}
|
|
14
|
-
__name(mapGetOrDefault, "mapGetOrDefault");
|
|
15
|
-
|
|
16
|
-
exports.mapGetOrDefault = mapGetOrDefault;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Gets a value from a map or creates it using a factory function if it doesn't exist.
|
|
5
|
-
*/
|
|
6
|
-
declare function mapGetOrDefault<K, V, T extends GenericMap<K, V, 'get' | 'has' | 'set'>>(map: T, key: K, factory: (key: K, map: T) => V): V;
|
|
7
|
-
|
|
8
|
-
export { mapGetOrDefault };
|
package/lib/mapGetOrDefault.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Gets a value from a map or creates it using a factory function if it doesn't exist.
|
|
5
|
-
*/
|
|
6
|
-
declare function mapGetOrDefault<K, V, T extends GenericMap<K, V, 'get' | 'has' | 'set'>>(map: T, key: K, factory: (key: K, map: T) => V): V;
|
|
7
|
-
|
|
8
|
-
export { mapGetOrDefault };
|
package/lib/mapGetOrDefault.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
-
|
|
3
|
-
function mapGetOrDefault(map, key, factory) {
|
|
4
|
-
let value = map.get(key);
|
|
5
|
-
if (value !== void 0 || map.has(key)) {
|
|
6
|
-
return value;
|
|
7
|
-
}
|
|
8
|
-
value = factory(key, map);
|
|
9
|
-
map.set(key, value);
|
|
10
|
-
return value;
|
|
11
|
-
}
|
|
12
|
-
__name(mapGetOrDefault, "mapGetOrDefault");
|
|
13
|
-
|
|
14
|
-
export { mapGetOrDefault };
|
package/lib/mapLoad.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
function mapLoad(ins, entries) {
|
|
6
|
-
for (const [key, value] of entries) {
|
|
7
|
-
ins.set(key, value);
|
|
8
|
-
}
|
|
9
|
-
return ins;
|
|
10
|
-
}
|
|
11
|
-
__name(mapLoad, "mapLoad");
|
|
12
|
-
|
|
13
|
-
exports.mapLoad = mapLoad;
|
package/lib/mapLoad.d.cts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Loads multiple entries into the map from an iterable.
|
|
5
|
-
*
|
|
6
|
-
* @param entries - An iterable of key-value pairs to load into the map
|
|
7
|
-
* @returns The map instance for method chaining
|
|
8
|
-
*/
|
|
9
|
-
declare function mapLoad<T extends GenericMap<K, V, 'set'>, K, V>(ins: T, entries: Iterable<[K, V]>): T;
|
|
10
|
-
|
|
11
|
-
export { mapLoad };
|
package/lib/mapLoad.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Loads multiple entries into the map from an iterable.
|
|
5
|
-
*
|
|
6
|
-
* @param entries - An iterable of key-value pairs to load into the map
|
|
7
|
-
* @returns The map instance for method chaining
|
|
8
|
-
*/
|
|
9
|
-
declare function mapLoad<T extends GenericMap<K, V, 'set'>, K, V>(ins: T, entries: Iterable<[K, V]>): T;
|
|
10
|
-
|
|
11
|
-
export { mapLoad };
|
package/lib/mapLoad.js
DELETED
package/lib/mapReverse.cjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var mapLoad = require('./mapLoad');
|
|
4
|
-
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
function mapReverse(ins) {
|
|
8
|
-
const entries = Array.from(ins).reverse();
|
|
9
|
-
ins.clear();
|
|
10
|
-
mapLoad.mapLoad(ins, entries);
|
|
11
|
-
return ins;
|
|
12
|
-
}
|
|
13
|
-
__name(mapReverse, "mapReverse");
|
|
14
|
-
|
|
15
|
-
exports.mapReverse = mapReverse;
|
package/lib/mapReverse.d.cts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Reverses the order of entries in a Map.
|
|
5
|
-
* @remarks This function creates a new Map with the entries of the original Map in reverse order.
|
|
6
|
-
* The original Map is not modified.
|
|
7
|
-
* @example ```ts
|
|
8
|
-
* mapReverse(new Map([['a', 1], ['b', 2], ['c', 3]]));
|
|
9
|
-
* //=> [['c', 3], ['b', 2], ['a', 1]]
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
declare function mapReverse<T extends GenericMap<K, V, 'set' | 'clear' | typeof Symbol.iterator>, K, V>(ins: T): T;
|
|
13
|
-
declare function mapReverse<K, V>(ins: Map<K, V>): Map<K, V>;
|
|
14
|
-
|
|
15
|
-
export { mapReverse };
|
package/lib/mapReverse.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Reverses the order of entries in a Map.
|
|
5
|
-
* @remarks This function creates a new Map with the entries of the original Map in reverse order.
|
|
6
|
-
* The original Map is not modified.
|
|
7
|
-
* @example ```ts
|
|
8
|
-
* mapReverse(new Map([['a', 1], ['b', 2], ['c', 3]]));
|
|
9
|
-
* //=> [['c', 3], ['b', 2], ['a', 1]]
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
declare function mapReverse<T extends GenericMap<K, V, 'set' | 'clear' | typeof Symbol.iterator>, K, V>(ins: T): T;
|
|
13
|
-
declare function mapReverse<K, V>(ins: Map<K, V>): Map<K, V>;
|
|
14
|
-
|
|
15
|
-
export { mapReverse };
|
package/lib/mapReverse.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
-
import { mapLoad } from './mapLoad';
|
|
3
|
-
|
|
4
|
-
function mapReverse(ins) {
|
|
5
|
-
const entries = Array.from(ins).reverse();
|
|
6
|
-
ins.clear();
|
|
7
|
-
mapLoad(ins, entries);
|
|
8
|
-
return ins;
|
|
9
|
-
}
|
|
10
|
-
__name(mapReverse, "mapReverse");
|
|
11
|
-
|
|
12
|
-
export { mapReverse };
|
package/lib/mapUpdate.cjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
function mapUpdate(ins, key, update) {
|
|
6
|
-
const newValue = update(ins.get(key), key, ins);
|
|
7
|
-
ins.set(key, newValue);
|
|
8
|
-
return ins;
|
|
9
|
-
}
|
|
10
|
-
__name(mapUpdate, "mapUpdate");
|
|
11
|
-
|
|
12
|
-
exports.mapUpdate = mapUpdate;
|
package/lib/mapUpdate.d.cts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Updates a value in the map using an update function.
|
|
5
|
-
*
|
|
6
|
-
* @param key - The key to update
|
|
7
|
-
* @param update - Function that receives the current value and returns the new value
|
|
8
|
-
* @returns The map instance for method chaining
|
|
9
|
-
*/
|
|
10
|
-
declare function mapUpdate<T extends GenericMap<K, V, 'set' | 'get'>, K, V>(ins: T, key: K, update: (value: V | undefined, key: K, map: T) => V): T;
|
|
11
|
-
declare function mapUpdate<K, V>(ins: Map<K, V>, key: K, update: (value: V | undefined, key: K, map: Map<K, V>) => V): typeof ins;
|
|
12
|
-
|
|
13
|
-
export { mapUpdate };
|
package/lib/mapUpdate.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Updates a value in the map using an update function.
|
|
5
|
-
*
|
|
6
|
-
* @param key - The key to update
|
|
7
|
-
* @param update - Function that receives the current value and returns the new value
|
|
8
|
-
* @returns The map instance for method chaining
|
|
9
|
-
*/
|
|
10
|
-
declare function mapUpdate<T extends GenericMap<K, V, 'set' | 'get'>, K, V>(ins: T, key: K, update: (value: V | undefined, key: K, map: T) => V): T;
|
|
11
|
-
declare function mapUpdate<K, V>(ins: Map<K, V>, key: K, update: (value: V | undefined, key: K, map: Map<K, V>) => V): typeof ins;
|
|
12
|
-
|
|
13
|
-
export { mapUpdate };
|
package/lib/mapUpdate.js
DELETED
package/lib/sort.cjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
function sort(ins, compare) {
|
|
6
|
-
const entries = Array.from(ins).sort(compare);
|
|
7
|
-
ins.clear();
|
|
8
|
-
for (const [k, v] of entries) {
|
|
9
|
-
ins.set(k, v);
|
|
10
|
-
}
|
|
11
|
-
return ins;
|
|
12
|
-
}
|
|
13
|
-
__name(sort, "sort");
|
|
14
|
-
|
|
15
|
-
exports.sort = sort;
|
package/lib/sort.d.cts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Sorts the map entries using a custom comparison function and updates the map in place.
|
|
5
|
-
* This is Map-specific because it maintains insertion order.
|
|
6
|
-
*
|
|
7
|
-
* @param ins - The map instance to sort
|
|
8
|
-
* @param compare - Function that compares two entries
|
|
9
|
-
* @returns The map instance for method chaining
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const map = new ExtMap<string, number>([
|
|
14
|
-
* ['c', 3],
|
|
15
|
-
* ['a', 1],
|
|
16
|
-
* ['b', 2],
|
|
17
|
-
* ])
|
|
18
|
-
*
|
|
19
|
-
* sort(map, ([k1], [k2]) => k1.localeCompare(k2))
|
|
20
|
-
* console.log(entriesArray(map)) // [['a', 1], ['b', 2], ['c', 3]]
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
declare function sort<K, V>(ins: GenericMap<K, V, 'set' | 'clear' | typeof Symbol.iterator>, compare: (a: [K, V], b: [K, V]) => number): GenericMap<K, V, 'set' | 'clear' | typeof Symbol.iterator>;
|
|
24
|
-
|
|
25
|
-
export { sort };
|
package/lib/sort.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Sorts the map entries using a custom comparison function and updates the map in place.
|
|
5
|
-
* This is Map-specific because it maintains insertion order.
|
|
6
|
-
*
|
|
7
|
-
* @param ins - The map instance to sort
|
|
8
|
-
* @param compare - Function that compares two entries
|
|
9
|
-
* @returns The map instance for method chaining
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const map = new ExtMap<string, number>([
|
|
14
|
-
* ['c', 3],
|
|
15
|
-
* ['a', 1],
|
|
16
|
-
* ['b', 2],
|
|
17
|
-
* ])
|
|
18
|
-
*
|
|
19
|
-
* sort(map, ([k1], [k2]) => k1.localeCompare(k2))
|
|
20
|
-
* console.log(entriesArray(map)) // [['a', 1], ['b', 2], ['c', 3]]
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
declare function sort<K, V>(ins: GenericMap<K, V, 'set' | 'clear' | typeof Symbol.iterator>, compare: (a: [K, V], b: [K, V]) => number): GenericMap<K, V, 'set' | 'clear' | typeof Symbol.iterator>;
|
|
24
|
-
|
|
25
|
-
export { sort };
|
package/lib/sort.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
-
|
|
3
|
-
function sort(ins, compare) {
|
|
4
|
-
const entries = Array.from(ins).sort(compare);
|
|
5
|
-
ins.clear();
|
|
6
|
-
for (const [k, v] of entries) {
|
|
7
|
-
ins.set(k, v);
|
|
8
|
-
}
|
|
9
|
-
return ins;
|
|
10
|
-
}
|
|
11
|
-
__name(sort, "sort");
|
|
12
|
-
|
|
13
|
-
export { sort };
|
package/lib/sortByKeys.cjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
function sortByKeys(ins, compare) {
|
|
6
|
-
const entries = Array.from(ins).sort((a, b) => {
|
|
7
|
-
return compare(a[0], b[0]);
|
|
8
|
-
});
|
|
9
|
-
ins.clear();
|
|
10
|
-
for (const [k, v] of entries) {
|
|
11
|
-
ins.set(k, v);
|
|
12
|
-
}
|
|
13
|
-
return ins;
|
|
14
|
-
}
|
|
15
|
-
__name(sortByKeys, "sortByKeys");
|
|
16
|
-
|
|
17
|
-
exports.sortByKeys = sortByKeys;
|
package/lib/sortByKeys.d.cts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Sorts the map entries by their keys and updates the map in place.
|
|
5
|
-
*
|
|
6
|
-
* @param ins - The map instance to sort
|
|
7
|
-
* @param compare - Function that compares two keys
|
|
8
|
-
* @returns The map instance for method chaining
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* const map = new ExtMap<string, number>([
|
|
13
|
-
* ['c', 3],
|
|
14
|
-
* ['a', 1],
|
|
15
|
-
* ['b', 2],
|
|
16
|
-
* ])
|
|
17
|
-
*
|
|
18
|
-
* sortByKeys(map, (a, b) => a.localeCompare(b))
|
|
19
|
-
* console.log(entriesArray(map)) // [['a', 1], ['b', 2], ['c', 3]]
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
declare function sortByKeys<K, V>(ins: GenericMap<K, V, 'set' | 'clear' | typeof Symbol.iterator>, compare: (a: K, b: K) => number): GenericMap<K, V, 'set' | 'clear' | typeof Symbol.iterator>;
|
|
23
|
-
|
|
24
|
-
export { sortByKeys };
|
package/lib/sortByKeys.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Sorts the map entries by their keys and updates the map in place.
|
|
5
|
-
*
|
|
6
|
-
* @param ins - The map instance to sort
|
|
7
|
-
* @param compare - Function that compares two keys
|
|
8
|
-
* @returns The map instance for method chaining
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* const map = new ExtMap<string, number>([
|
|
13
|
-
* ['c', 3],
|
|
14
|
-
* ['a', 1],
|
|
15
|
-
* ['b', 2],
|
|
16
|
-
* ])
|
|
17
|
-
*
|
|
18
|
-
* sortByKeys(map, (a, b) => a.localeCompare(b))
|
|
19
|
-
* console.log(entriesArray(map)) // [['a', 1], ['b', 2], ['c', 3]]
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
declare function sortByKeys<K, V>(ins: GenericMap<K, V, 'set' | 'clear' | typeof Symbol.iterator>, compare: (a: K, b: K) => number): GenericMap<K, V, 'set' | 'clear' | typeof Symbol.iterator>;
|
|
23
|
-
|
|
24
|
-
export { sortByKeys };
|
package/lib/sortByKeys.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
-
|
|
3
|
-
function sortByKeys(ins, compare) {
|
|
4
|
-
const entries = Array.from(ins).sort((a, b) => {
|
|
5
|
-
return compare(a[0], b[0]);
|
|
6
|
-
});
|
|
7
|
-
ins.clear();
|
|
8
|
-
for (const [k, v] of entries) {
|
|
9
|
-
ins.set(k, v);
|
|
10
|
-
}
|
|
11
|
-
return ins;
|
|
12
|
-
}
|
|
13
|
-
__name(sortByKeys, "sortByKeys");
|
|
14
|
-
|
|
15
|
-
export { sortByKeys };
|
package/lib/sortByValues.cjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
function sortByValues(ins, compare) {
|
|
6
|
-
const entries = Array.from(ins).sort((a, b) => {
|
|
7
|
-
return compare(a[1], b[1]);
|
|
8
|
-
});
|
|
9
|
-
ins.clear();
|
|
10
|
-
for (const [k, v] of entries) {
|
|
11
|
-
ins.set(k, v);
|
|
12
|
-
}
|
|
13
|
-
return ins;
|
|
14
|
-
}
|
|
15
|
-
__name(sortByValues, "sortByValues");
|
|
16
|
-
|
|
17
|
-
exports.sortByValues = sortByValues;
|
package/lib/sortByValues.d.cts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Sorts the map entries by their values and updates the map in place.
|
|
5
|
-
*
|
|
6
|
-
* @param ins - The map instance to sort
|
|
7
|
-
* @param compare - Function that compares two values
|
|
8
|
-
* @returns The map instance for method chaining
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* const map = new ExtMap<string, number>([
|
|
13
|
-
* ['c', 3],
|
|
14
|
-
* ['a', 1],
|
|
15
|
-
* ['b', 2],
|
|
16
|
-
* ])
|
|
17
|
-
*
|
|
18
|
-
* sortByValues(map, (a, b) => a - b)
|
|
19
|
-
* console.log(entriesArray(map)) // [['a', 1], ['b', 2], ['c', 3]]
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
declare function sortByValues<T extends GenericMap<K, V, 'set' | 'clear' | typeof Symbol.iterator>, K, V>(ins: T, compare: (a: V, b: V) => number): T;
|
|
23
|
-
declare function sortByValues<K, V>(ins: GenericMap<K, V, 'set' | 'clear' | typeof Symbol.iterator>, compare: (a: V, b: V) => number): GenericMap<K, V, 'set' | 'clear' | typeof Symbol.iterator>;
|
|
24
|
-
|
|
25
|
-
export { sortByValues };
|
package/lib/sortByValues.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Sorts the map entries by their values and updates the map in place.
|
|
5
|
-
*
|
|
6
|
-
* @param ins - The map instance to sort
|
|
7
|
-
* @param compare - Function that compares two values
|
|
8
|
-
* @returns The map instance for method chaining
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* const map = new ExtMap<string, number>([
|
|
13
|
-
* ['c', 3],
|
|
14
|
-
* ['a', 1],
|
|
15
|
-
* ['b', 2],
|
|
16
|
-
* ])
|
|
17
|
-
*
|
|
18
|
-
* sortByValues(map, (a, b) => a - b)
|
|
19
|
-
* console.log(entriesArray(map)) // [['a', 1], ['b', 2], ['c', 3]]
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
declare function sortByValues<T extends GenericMap<K, V, 'set' | 'clear' | typeof Symbol.iterator>, K, V>(ins: T, compare: (a: V, b: V) => number): T;
|
|
23
|
-
declare function sortByValues<K, V>(ins: GenericMap<K, V, 'set' | 'clear' | typeof Symbol.iterator>, compare: (a: V, b: V) => number): GenericMap<K, V, 'set' | 'clear' | typeof Symbol.iterator>;
|
|
24
|
-
|
|
25
|
-
export { sortByValues };
|
package/lib/sortByValues.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
-
|
|
3
|
-
function sortByValues(ins, compare) {
|
|
4
|
-
const entries = Array.from(ins).sort((a, b) => {
|
|
5
|
-
return compare(a[1], b[1]);
|
|
6
|
-
});
|
|
7
|
-
ins.clear();
|
|
8
|
-
for (const [k, v] of entries) {
|
|
9
|
-
ins.set(k, v);
|
|
10
|
-
}
|
|
11
|
-
return ins;
|
|
12
|
-
}
|
|
13
|
-
__name(sortByValues, "sortByValues");
|
|
14
|
-
|
|
15
|
-
export { sortByValues };
|
package/lib/toMap.cjs
DELETED
package/lib/toMap.d.cts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Converts a GenericMap to a native Map.
|
|
5
|
-
*
|
|
6
|
-
* @param ins - The GenericMap instance to convert
|
|
7
|
-
* @returns A new native Map with the same entries
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* const extMap = new ExtMap<string, number>()
|
|
12
|
-
* .load([['a', 1], ['b', 2], ['c', 3]])
|
|
13
|
-
*
|
|
14
|
-
* const nativeMap = toMap(extMap)
|
|
15
|
-
* console.log(nativeMap instanceof Map) // true
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
declare function toMap<K, V>(ins: GenericMap<K, V, typeof Symbol.iterator>): Map<K, V>;
|
|
19
|
-
|
|
20
|
-
export { toMap };
|
package/lib/toMap.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Converts a GenericMap to a native Map.
|
|
5
|
-
*
|
|
6
|
-
* @param ins - The GenericMap instance to convert
|
|
7
|
-
* @returns A new native Map with the same entries
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* const extMap = new ExtMap<string, number>()
|
|
12
|
-
* .load([['a', 1], ['b', 2], ['c', 3]])
|
|
13
|
-
*
|
|
14
|
-
* const nativeMap = toMap(extMap)
|
|
15
|
-
* console.log(nativeMap instanceof Map) // true
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
declare function toMap<K, V>(ins: GenericMap<K, V, typeof Symbol.iterator>): Map<K, V>;
|
|
19
|
-
|
|
20
|
-
export { toMap };
|
package/lib/toMap.js
DELETED
package/lib/valuesArray.cjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
function valuesArray(ins) {
|
|
6
|
-
return Array.from(ins.values());
|
|
7
|
-
}
|
|
8
|
-
__name(valuesArray, "valuesArray");
|
|
9
|
-
|
|
10
|
-
exports.valuesArray = valuesArray;
|
package/lib/valuesArray.d.cts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns an array of all values in the map.
|
|
5
|
-
* Convenience method that converts the values iterator to an array.
|
|
6
|
-
*
|
|
7
|
-
* @returns Array of all values
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* const map = new ExtMap<string, number>()
|
|
12
|
-
* .load([['a', 1], ['b', 2], ['c', 3]])
|
|
13
|
-
*
|
|
14
|
-
* console.log(valuesArray(map)) // [1, 2, 3]
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
declare function valuesArray<K, V>(ins: GenericMap<K, V, 'values'>): V[];
|
|
18
|
-
|
|
19
|
-
export { valuesArray };
|
package/lib/valuesArray.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { G as GenericMap } from './GenericMap-B4OM3vGu.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns an array of all values in the map.
|
|
5
|
-
* Convenience method that converts the values iterator to an array.
|
|
6
|
-
*
|
|
7
|
-
* @returns Array of all values
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* const map = new ExtMap<string, number>()
|
|
12
|
-
* .load([['a', 1], ['b', 2], ['c', 3]])
|
|
13
|
-
*
|
|
14
|
-
* console.log(valuesArray(map)) // [1, 2, 3]
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
declare function valuesArray<K, V>(ins: GenericMap<K, V, 'values'>): V[];
|
|
18
|
-
|
|
19
|
-
export { valuesArray };
|