@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.
Files changed (65) hide show
  1. package/lib/index.cjs +414 -108
  2. package/lib/index.d.cts +364 -17
  3. package/lib/index.d.ts +364 -17
  4. package/lib/index.js +400 -15
  5. package/package.json +81 -141
  6. package/lib/ExtMap.cjs +0 -104
  7. package/lib/ExtMap.d.cts +0 -110
  8. package/lib/ExtMap.d.ts +0 -110
  9. package/lib/ExtMap.js +0 -101
  10. package/lib/TimeoutWeakMap.cjs +0 -120
  11. package/lib/TimeoutWeakMap.d.cts +0 -75
  12. package/lib/TimeoutWeakMap.d.ts +0 -75
  13. package/lib/TimeoutWeakMap.js +0 -118
  14. package/lib/countUniques.cjs +0 -18
  15. package/lib/countUniques.d.cts +0 -9
  16. package/lib/countUniques.d.ts +0 -9
  17. package/lib/countUniques.js +0 -15
  18. package/lib/entriesArray.cjs +0 -10
  19. package/lib/entriesArray.d.cts +0 -19
  20. package/lib/entriesArray.d.ts +0 -19
  21. package/lib/entriesArray.js +0 -8
  22. package/lib/isGenericMap.cjs +0 -16
  23. package/lib/isGenericMap.d.cts +0 -6
  24. package/lib/isGenericMap.d.ts +0 -6
  25. package/lib/isGenericMap.js +0 -14
  26. package/lib/keysArray.cjs +0 -10
  27. package/lib/keysArray.d.cts +0 -19
  28. package/lib/keysArray.d.ts +0 -19
  29. package/lib/keysArray.js +0 -8
  30. package/lib/mapGetOrDefault.cjs +0 -16
  31. package/lib/mapGetOrDefault.d.cts +0 -8
  32. package/lib/mapGetOrDefault.d.ts +0 -8
  33. package/lib/mapGetOrDefault.js +0 -14
  34. package/lib/mapLoad.cjs +0 -13
  35. package/lib/mapLoad.d.cts +0 -11
  36. package/lib/mapLoad.d.ts +0 -11
  37. package/lib/mapLoad.js +0 -11
  38. package/lib/mapReverse.cjs +0 -15
  39. package/lib/mapReverse.d.cts +0 -15
  40. package/lib/mapReverse.d.ts +0 -15
  41. package/lib/mapReverse.js +0 -12
  42. package/lib/mapUpdate.cjs +0 -12
  43. package/lib/mapUpdate.d.cts +0 -13
  44. package/lib/mapUpdate.d.ts +0 -13
  45. package/lib/mapUpdate.js +0 -10
  46. package/lib/sort.cjs +0 -15
  47. package/lib/sort.d.cts +0 -25
  48. package/lib/sort.d.ts +0 -25
  49. package/lib/sort.js +0 -13
  50. package/lib/sortByKeys.cjs +0 -17
  51. package/lib/sortByKeys.d.cts +0 -24
  52. package/lib/sortByKeys.d.ts +0 -24
  53. package/lib/sortByKeys.js +0 -15
  54. package/lib/sortByValues.cjs +0 -17
  55. package/lib/sortByValues.d.cts +0 -25
  56. package/lib/sortByValues.d.ts +0 -25
  57. package/lib/sortByValues.js +0 -15
  58. package/lib/toMap.cjs +0 -10
  59. package/lib/toMap.d.cts +0 -20
  60. package/lib/toMap.d.ts +0 -20
  61. package/lib/toMap.js +0 -8
  62. package/lib/valuesArray.cjs +0 -10
  63. package/lib/valuesArray.d.cts +0 -19
  64. package/lib/valuesArray.d.ts +0 -19
  65. package/lib/valuesArray.js +0 -8
package/lib/ExtMap.js DELETED
@@ -1,101 +0,0 @@
1
- import { __name } from './chunk-SHUYVCID.js';
2
- import { View, inheritProxifiedPrototype } from '@mono/composition';
3
- import { defineMethod } from '@mono/object/defineMethod';
4
- import { entriesArray } from './entriesArray';
5
- import { entriesOf } from '@mono/object/entriesOf';
6
- import { filterIterableValues } from '@mono/iter/filterIterableValues';
7
- import { inspect } from 'util';
8
- import { isIterable } from 'iter-tools';
9
- import { keysArray } from './keysArray';
10
- import { mapGetOrDefault } from './mapGetOrDefault';
11
- import { mapIterableKeys } from '@mono/iter/mapIterableKeys';
12
- import { mapIterableValues } from '@mono/iter/mapIterableValues';
13
- import { mapLoad } from './mapLoad';
14
- import { mapReverse } from './mapReverse';
15
- import { mapUpdate } from './mapUpdate';
16
- import { reduceIterableValues } from '@mono/iter/reduceIterableValues';
17
- import { sort } from './sort';
18
- import { sortByKeys } from './sortByKeys';
19
- import { sortByValues } from './sortByValues';
20
- import { thisify } from '@mono/fn/thisify';
21
- import { toMap } from './toMap';
22
- import { toObjectIterable } from '@mono/iter/toObjectIterable';
23
- import { transformReturnValue } from '@mono/fn/transformReturnValue';
24
- import { valuesArray } from './valuesArray';
25
-
26
- class ExtMap extends View {
27
- static {
28
- __name(this, "ExtMap");
29
- }
30
- constructor(arg) {
31
- super(new Map(isIterable(arg) ? arg : arg ? entriesOf(arg) : void 0));
32
- }
33
- /**
34
- * Creates a new ExtMap instance from a regular object.
35
- *
36
- * @param obj - An object whose key-value pairs will be used to initialize the map
37
- * @returns A new ExtMap instance containing the entries from the object
38
- */
39
- static fromObject(obj) {
40
- return new ExtMap(Object.entries(obj));
41
- }
42
- /**
43
- * Creates a new ExtMap instance from an iterable of key-value pairs.
44
- *
45
- * @param entries - An iterable of key-value pairs to initialize the map
46
- * @returns A new ExtMap instance containing the provided entries
47
- */
48
- static fromIterable(entries) {
49
- return new ExtMap(entries);
50
- }
51
- /**
52
- * Creates a shallow copy of the map.
53
- *
54
- * @returns A new ExtMap instance with the same entries
55
- */
56
- clone() {
57
- return new ExtMap(this);
58
- }
59
- /**
60
- * Converts the map to a JSON-serializable format.
61
- *
62
- * @returns Array of key-value pairs suitable for JSON serialization
63
- */
64
- toJSON() {
65
- return [
66
- ...this.entries()
67
- ];
68
- }
69
- /**
70
- * Custom inspection method for better debugging output.
71
- *
72
- * @param _depth - The depth of inspection
73
- * @param _options - Options for inspection
74
- * @returns A string representation of the map
75
- */
76
- [inspect.custom](_depth, _options) {
77
- return inspect(this.target, {
78
- breakLength: 50
79
- });
80
- }
81
- }
82
- inheritProxifiedPrototype(ExtMap, Map, []);
83
- defineMethod(ExtMap.prototype, "load", thisify(mapLoad));
84
- defineMethod(ExtMap.prototype, "sort", thisify(sort));
85
- defineMethod(ExtMap.prototype, "sortByKeys", thisify(sortByKeys));
86
- defineMethod(ExtMap.prototype, "sortByValues", thisify(sortByValues));
87
- defineMethod(ExtMap.prototype, "reverse", thisify(mapReverse));
88
- defineMethod(ExtMap.prototype, "update", thisify(mapUpdate));
89
- defineMethod(ExtMap.prototype, "getOrDefault", thisify(mapGetOrDefault));
90
- defineMethod(ExtMap.prototype, "keysArray", thisify(keysArray));
91
- defineMethod(ExtMap.prototype, "valuesArray", thisify(valuesArray));
92
- defineMethod(ExtMap.prototype, "entriesArray", thisify(entriesArray));
93
- defineMethod(ExtMap.prototype, "toObject", thisify(toObjectIterable));
94
- defineMethod(ExtMap.prototype, "toMap", thisify(toMap));
95
- defineMethod(ExtMap.prototype, "reduce", thisify(reduceIterableValues));
96
- defineMethod(ExtMap.prototype, "map", thisify(transformReturnValue(mapIterableValues, ExtMap.fromIterable)));
97
- defineMethod(ExtMap.prototype, "mapKeys", thisify(transformReturnValue(mapIterableKeys, ExtMap.fromIterable)));
98
- defineMethod(ExtMap.prototype, "mapValues", thisify(transformReturnValue(mapIterableValues, ExtMap.fromIterable)));
99
- defineMethod(ExtMap.prototype, "filter", thisify(transformReturnValue(filterIterableValues, ExtMap.fromIterable)));
100
-
101
- export { ExtMap };
@@ -1,120 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- class TimeoutWeakMap {
6
- static {
7
- __name(this, "TimeoutWeakMap");
8
- }
9
- timeoutMs;
10
- wmap = /* @__PURE__ */ new WeakMap();
11
- /**
12
- * @param timeoutMs Default timeout in milliseconds for entries
13
- */
14
- constructor(timeoutMs) {
15
- this.timeoutMs = timeoutMs;
16
- }
17
- /**
18
- * Retrieves the value for the given key and refreshes its timeout.
19
- *
20
- * @param key The key to retrieve
21
- * @returns The value if found, undefined otherwise
22
- */
23
- get(key) {
24
- const vt = this.wmap.get(key);
25
- if (!vt) {
26
- return void 0;
27
- }
28
- const [value, timeout] = vt;
29
- timeout.refresh();
30
- return value;
31
- }
32
- /**
33
- * Sets a key-value pair with an optional custom timeout.
34
- *
35
- * @param key The key to set
36
- * @param value The value to associate with the key
37
- * @param timeoutMs Optional timeout override for this entry
38
- * @returns This instance for chaining
39
- */
40
- set(key, value, timeoutMs) {
41
- this.wmap.set(key, [
42
- value,
43
- setTimeout(() => {
44
- this.delete(key);
45
- }, timeoutMs ?? this.timeoutMs).unref()
46
- ]);
47
- return this;
48
- }
49
- /**
50
- * Removes a key-value pair and clears its timeout.
51
- *
52
- * @param key The key to delete
53
- * @returns True if the key existed and was deleted, false otherwise
54
- */
55
- delete(key) {
56
- const vt = this.wmap.get(key);
57
- if (!vt) {
58
- return false;
59
- }
60
- const timeout = vt[1];
61
- clearTimeout(timeout);
62
- return this.wmap.delete(key);
63
- }
64
- /**
65
- * Checks if a key exists in the map.
66
- * Does not refresh the timeout.
67
- *
68
- * @param key The key to check
69
- * @returns True if the key exists, false otherwise
70
- */
71
- has(key) {
72
- return this.wmap.has(key);
73
- }
74
- /**
75
- * Loads multiple key-value pairs into the map.
76
- *
77
- * @param entries Iterable of key-value pairs to load
78
- * @param timeoutMs Optional timeout override for all entries
79
- * @returns This instance for chaining
80
- */
81
- load(entries, timeoutMs) {
82
- for (const [key, value] of entries) {
83
- this.set(key, value, timeoutMs);
84
- }
85
- return this;
86
- }
87
- /**
88
- * Updates an existing value or creates a new one using an update function.
89
- *
90
- * @param key The key to update
91
- * @param update Function that receives the current value and returns the new value
92
- * @returns This instance for chaining
93
- */
94
- update(key, update) {
95
- return this.set(key, update(this.get(key), key, this));
96
- }
97
- /**
98
- * Gets a value or creates it using a factory function if it doesn't exist.
99
- * Refreshes timeout if the value exists.
100
- *
101
- * @param key The key to get or create
102
- * @param factory Function to create the value if it doesn't exist
103
- * @param timeoutMs Optional timeout override for new entries
104
- * @returns The existing or newly created value
105
- */
106
- getOrDefault(key, factory, timeoutMs) {
107
- const vt = this.wmap.get(key);
108
- if (vt) {
109
- const [value, timeout] = vt;
110
- timeout.refresh();
111
- return value;
112
- } else {
113
- const value = factory(key, this);
114
- this.set(key, value, timeoutMs);
115
- return value;
116
- }
117
- }
118
- }
119
-
120
- exports.TimeoutWeakMap = TimeoutWeakMap;
@@ -1,75 +0,0 @@
1
- /**
2
- * A WeakMap with automatic timeout-based expiry for entries.
3
- *
4
- * Entries are automatically removed after a specified timeout period.
5
- * Accessing an entry refreshes its timeout, extending its lifetime.
6
- * This is useful for caching scenarios where you want automatic cleanup
7
- * of unused entries while keeping frequently accessed ones alive.
8
- */
9
- declare class TimeoutWeakMap<K extends object, V> {
10
- readonly timeoutMs: number;
11
- protected readonly wmap: WeakMap<K, [V, NodeJS.Timeout]>;
12
- /**
13
- * @param timeoutMs Default timeout in milliseconds for entries
14
- */
15
- constructor(timeoutMs: number);
16
- /**
17
- * Retrieves the value for the given key and refreshes its timeout.
18
- *
19
- * @param key The key to retrieve
20
- * @returns The value if found, undefined otherwise
21
- */
22
- get(key: K): V | undefined;
23
- /**
24
- * Sets a key-value pair with an optional custom timeout.
25
- *
26
- * @param key The key to set
27
- * @param value The value to associate with the key
28
- * @param timeoutMs Optional timeout override for this entry
29
- * @returns This instance for chaining
30
- */
31
- set(key: K, value: V, timeoutMs?: number): this;
32
- /**
33
- * Removes a key-value pair and clears its timeout.
34
- *
35
- * @param key The key to delete
36
- * @returns True if the key existed and was deleted, false otherwise
37
- */
38
- delete(key: K): boolean;
39
- /**
40
- * Checks if a key exists in the map.
41
- * Does not refresh the timeout.
42
- *
43
- * @param key The key to check
44
- * @returns True if the key exists, false otherwise
45
- */
46
- has(key: K): boolean;
47
- /**
48
- * Loads multiple key-value pairs into the map.
49
- *
50
- * @param entries Iterable of key-value pairs to load
51
- * @param timeoutMs Optional timeout override for all entries
52
- * @returns This instance for chaining
53
- */
54
- load(entries: Iterable<[K, V]>, timeoutMs?: number): this;
55
- /**
56
- * Updates an existing value or creates a new one using an update function.
57
- *
58
- * @param key The key to update
59
- * @param update Function that receives the current value and returns the new value
60
- * @returns This instance for chaining
61
- */
62
- update(key: K, update: (value: V | undefined, key: K, map: this) => V): this;
63
- /**
64
- * Gets a value or creates it using a factory function if it doesn't exist.
65
- * Refreshes timeout if the value exists.
66
- *
67
- * @param key The key to get or create
68
- * @param factory Function to create the value if it doesn't exist
69
- * @param timeoutMs Optional timeout override for new entries
70
- * @returns The existing or newly created value
71
- */
72
- getOrDefault(key: K, factory: (key: K, map: this) => V, timeoutMs?: number): V;
73
- }
74
-
75
- export { TimeoutWeakMap };
@@ -1,75 +0,0 @@
1
- /**
2
- * A WeakMap with automatic timeout-based expiry for entries.
3
- *
4
- * Entries are automatically removed after a specified timeout period.
5
- * Accessing an entry refreshes its timeout, extending its lifetime.
6
- * This is useful for caching scenarios where you want automatic cleanup
7
- * of unused entries while keeping frequently accessed ones alive.
8
- */
9
- declare class TimeoutWeakMap<K extends object, V> {
10
- readonly timeoutMs: number;
11
- protected readonly wmap: WeakMap<K, [V, NodeJS.Timeout]>;
12
- /**
13
- * @param timeoutMs Default timeout in milliseconds for entries
14
- */
15
- constructor(timeoutMs: number);
16
- /**
17
- * Retrieves the value for the given key and refreshes its timeout.
18
- *
19
- * @param key The key to retrieve
20
- * @returns The value if found, undefined otherwise
21
- */
22
- get(key: K): V | undefined;
23
- /**
24
- * Sets a key-value pair with an optional custom timeout.
25
- *
26
- * @param key The key to set
27
- * @param value The value to associate with the key
28
- * @param timeoutMs Optional timeout override for this entry
29
- * @returns This instance for chaining
30
- */
31
- set(key: K, value: V, timeoutMs?: number): this;
32
- /**
33
- * Removes a key-value pair and clears its timeout.
34
- *
35
- * @param key The key to delete
36
- * @returns True if the key existed and was deleted, false otherwise
37
- */
38
- delete(key: K): boolean;
39
- /**
40
- * Checks if a key exists in the map.
41
- * Does not refresh the timeout.
42
- *
43
- * @param key The key to check
44
- * @returns True if the key exists, false otherwise
45
- */
46
- has(key: K): boolean;
47
- /**
48
- * Loads multiple key-value pairs into the map.
49
- *
50
- * @param entries Iterable of key-value pairs to load
51
- * @param timeoutMs Optional timeout override for all entries
52
- * @returns This instance for chaining
53
- */
54
- load(entries: Iterable<[K, V]>, timeoutMs?: number): this;
55
- /**
56
- * Updates an existing value or creates a new one using an update function.
57
- *
58
- * @param key The key to update
59
- * @param update Function that receives the current value and returns the new value
60
- * @returns This instance for chaining
61
- */
62
- update(key: K, update: (value: V | undefined, key: K, map: this) => V): this;
63
- /**
64
- * Gets a value or creates it using a factory function if it doesn't exist.
65
- * Refreshes timeout if the value exists.
66
- *
67
- * @param key The key to get or create
68
- * @param factory Function to create the value if it doesn't exist
69
- * @param timeoutMs Optional timeout override for new entries
70
- * @returns The existing or newly created value
71
- */
72
- getOrDefault(key: K, factory: (key: K, map: this) => V, timeoutMs?: number): V;
73
- }
74
-
75
- export { TimeoutWeakMap };
@@ -1,118 +0,0 @@
1
- import { __name } from './chunk-SHUYVCID.js';
2
-
3
- class TimeoutWeakMap {
4
- static {
5
- __name(this, "TimeoutWeakMap");
6
- }
7
- timeoutMs;
8
- wmap = /* @__PURE__ */ new WeakMap();
9
- /**
10
- * @param timeoutMs Default timeout in milliseconds for entries
11
- */
12
- constructor(timeoutMs) {
13
- this.timeoutMs = timeoutMs;
14
- }
15
- /**
16
- * Retrieves the value for the given key and refreshes its timeout.
17
- *
18
- * @param key The key to retrieve
19
- * @returns The value if found, undefined otherwise
20
- */
21
- get(key) {
22
- const vt = this.wmap.get(key);
23
- if (!vt) {
24
- return void 0;
25
- }
26
- const [value, timeout] = vt;
27
- timeout.refresh();
28
- return value;
29
- }
30
- /**
31
- * Sets a key-value pair with an optional custom timeout.
32
- *
33
- * @param key The key to set
34
- * @param value The value to associate with the key
35
- * @param timeoutMs Optional timeout override for this entry
36
- * @returns This instance for chaining
37
- */
38
- set(key, value, timeoutMs) {
39
- this.wmap.set(key, [
40
- value,
41
- setTimeout(() => {
42
- this.delete(key);
43
- }, timeoutMs ?? this.timeoutMs).unref()
44
- ]);
45
- return this;
46
- }
47
- /**
48
- * Removes a key-value pair and clears its timeout.
49
- *
50
- * @param key The key to delete
51
- * @returns True if the key existed and was deleted, false otherwise
52
- */
53
- delete(key) {
54
- const vt = this.wmap.get(key);
55
- if (!vt) {
56
- return false;
57
- }
58
- const timeout = vt[1];
59
- clearTimeout(timeout);
60
- return this.wmap.delete(key);
61
- }
62
- /**
63
- * Checks if a key exists in the map.
64
- * Does not refresh the timeout.
65
- *
66
- * @param key The key to check
67
- * @returns True if the key exists, false otherwise
68
- */
69
- has(key) {
70
- return this.wmap.has(key);
71
- }
72
- /**
73
- * Loads multiple key-value pairs into the map.
74
- *
75
- * @param entries Iterable of key-value pairs to load
76
- * @param timeoutMs Optional timeout override for all entries
77
- * @returns This instance for chaining
78
- */
79
- load(entries, timeoutMs) {
80
- for (const [key, value] of entries) {
81
- this.set(key, value, timeoutMs);
82
- }
83
- return this;
84
- }
85
- /**
86
- * Updates an existing value or creates a new one using an update function.
87
- *
88
- * @param key The key to update
89
- * @param update Function that receives the current value and returns the new value
90
- * @returns This instance for chaining
91
- */
92
- update(key, update) {
93
- return this.set(key, update(this.get(key), key, this));
94
- }
95
- /**
96
- * Gets a value or creates it using a factory function if it doesn't exist.
97
- * Refreshes timeout if the value exists.
98
- *
99
- * @param key The key to get or create
100
- * @param factory Function to create the value if it doesn't exist
101
- * @param timeoutMs Optional timeout override for new entries
102
- * @returns The existing or newly created value
103
- */
104
- getOrDefault(key, factory, timeoutMs) {
105
- const vt = this.wmap.get(key);
106
- if (vt) {
107
- const [value, timeout] = vt;
108
- timeout.refresh();
109
- return value;
110
- } else {
111
- const value = factory(key, this);
112
- this.set(key, value, timeoutMs);
113
- return value;
114
- }
115
- }
116
- }
117
-
118
- export { TimeoutWeakMap };
@@ -1,18 +0,0 @@
1
- 'use strict';
2
-
3
- var ExtMap = require('./ExtMap');
4
- var mnemonist = require('mnemonist');
5
- var iterTools = require('iter-tools');
6
-
7
- var __defProp = Object.defineProperty;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- function countUniques(input) {
10
- return new ExtMap.ExtMap(iterTools.reduce(new mnemonist.MultiSet(), (acc, imp) => {
11
- return acc.add(imp);
12
- }, input).multiplicities()).sortByValues((a, b) => {
13
- return b - a;
14
- });
15
- }
16
- __name(countUniques, "countUniques");
17
-
18
- exports.countUniques = countUniques;
@@ -1,9 +0,0 @@
1
- import { ExtMap } from './ExtMap.cjs';
2
- import 'util';
3
-
4
- /**
5
- * Count unique occurrences of values in an iterable, returning a sorted map by count descending.
6
- */
7
- declare function countUniques<V>(input: Iterable<V>): ExtMap<V, number>;
8
-
9
- export { countUniques };
@@ -1,9 +0,0 @@
1
- import { ExtMap } from './ExtMap.js';
2
- import 'util';
3
-
4
- /**
5
- * Count unique occurrences of values in an iterable, returning a sorted map by count descending.
6
- */
7
- declare function countUniques<V>(input: Iterable<V>): ExtMap<V, number>;
8
-
9
- export { countUniques };
@@ -1,15 +0,0 @@
1
- import { __name } from './chunk-SHUYVCID.js';
2
- import { ExtMap } from './ExtMap';
3
- import { MultiSet } from 'mnemonist';
4
- import { reduce } from 'iter-tools';
5
-
6
- function countUniques(input) {
7
- return new ExtMap(reduce(new MultiSet(), (acc, imp) => {
8
- return acc.add(imp);
9
- }, input).multiplicities()).sortByValues((a, b) => {
10
- return b - a;
11
- });
12
- }
13
- __name(countUniques, "countUniques");
14
-
15
- export { countUniques };
@@ -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 entriesArray(ins) {
6
- return Array.from(ins);
7
- }
8
- __name(entriesArray, "entriesArray");
9
-
10
- exports.entriesArray = entriesArray;
@@ -1,19 +0,0 @@
1
- import { G as GenericMap } from './GenericMap-B4OM3vGu.cjs';
2
-
3
- /**
4
- * Returns an array of all key-value pairs in the map.
5
- * Convenience method that converts the entries iterator to an array.
6
- *
7
- * @returns Array of all key-value pairs
8
- *
9
- * @example
10
- * ```typescript
11
- * const map = new ExtMap<string, number>()
12
- * .load([['a', 1], ['b', 2], ['c', 3]])
13
- *
14
- * console.log(entriesArray(map)) // [['a', 1], ['b', 2], ['c', 3]]
15
- * ```
16
- */
17
- declare function entriesArray<K, V>(ins: GenericMap<K, V, typeof Symbol.iterator>): [K, V][];
18
-
19
- export { entriesArray };
@@ -1,19 +0,0 @@
1
- import { G as GenericMap } from './GenericMap-B4OM3vGu.js';
2
-
3
- /**
4
- * Returns an array of all key-value pairs in the map.
5
- * Convenience method that converts the entries iterator to an array.
6
- *
7
- * @returns Array of all key-value pairs
8
- *
9
- * @example
10
- * ```typescript
11
- * const map = new ExtMap<string, number>()
12
- * .load([['a', 1], ['b', 2], ['c', 3]])
13
- *
14
- * console.log(entriesArray(map)) // [['a', 1], ['b', 2], ['c', 3]]
15
- * ```
16
- */
17
- declare function entriesArray<K, V>(ins: GenericMap<K, V, typeof Symbol.iterator>): [K, V][];
18
-
19
- export { entriesArray };
@@ -1,8 +0,0 @@
1
- import { __name } from './chunk-SHUYVCID.js';
2
-
3
- function entriesArray(ins) {
4
- return Array.from(ins);
5
- }
6
- __name(entriesArray, "entriesArray");
7
-
8
- export { entriesArray };
@@ -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 isGenericMap(target, requiredProps = [
6
- "get",
7
- "set",
8
- "has"
9
- ]) {
10
- return !!target && requiredProps.every((prop) => {
11
- return typeof target[prop] === typeof Map.prototype[prop];
12
- });
13
- }
14
- __name(isGenericMap, "isGenericMap");
15
-
16
- exports.isGenericMap = isGenericMap;
@@ -1,6 +0,0 @@
1
- /**
2
- * Checks if the provided value implements the Map interface with the specified required properties.
3
- */
4
- declare function isGenericMap<Props extends (keyof Map<K, V>)[], K, V>(target: unknown, requiredProps?: Props): target is Pick<Map<K, V>, Props[number]>;
5
-
6
- export { isGenericMap };
@@ -1,6 +0,0 @@
1
- /**
2
- * Checks if the provided value implements the Map interface with the specified required properties.
3
- */
4
- declare function isGenericMap<Props extends (keyof Map<K, V>)[], K, V>(target: unknown, requiredProps?: Props): target is Pick<Map<K, V>, Props[number]>;
5
-
6
- export { isGenericMap };
@@ -1,14 +0,0 @@
1
- import { __name } from './chunk-SHUYVCID.js';
2
-
3
- function isGenericMap(target, requiredProps = [
4
- "get",
5
- "set",
6
- "has"
7
- ]) {
8
- return !!target && requiredProps.every((prop) => {
9
- return typeof target[prop] === typeof Map.prototype[prop];
10
- });
11
- }
12
- __name(isGenericMap, "isGenericMap");
13
-
14
- export { isGenericMap };
package/lib/keysArray.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 keysArray(ins) {
6
- return Array.from(ins.keys());
7
- }
8
- __name(keysArray, "keysArray");
9
-
10
- exports.keysArray = keysArray;