@bemoje/map 1.2.1 → 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 +33 -122
  2. package/lib/index.d.cts +364 -17
  3. package/lib/index.d.ts +364 -17
  4. package/lib/index.js +15 -104
  5. package/package.json +81 -141
  6. package/lib/ExtMap.cjs +0 -354
  7. package/lib/ExtMap.d.cts +0 -110
  8. package/lib/ExtMap.d.ts +0 -110
  9. package/lib/ExtMap.js +0 -352
  10. package/lib/TimeoutWeakMap.cjs +0 -122
  11. package/lib/TimeoutWeakMap.d.cts +0 -75
  12. package/lib/TimeoutWeakMap.d.ts +0 -75
  13. package/lib/TimeoutWeakMap.js +0 -120
  14. package/lib/countUniques.cjs +0 -363
  15. package/lib/countUniques.d.cts +0 -9
  16. package/lib/countUniques.d.ts +0 -9
  17. package/lib/countUniques.js +0 -361
  18. package/lib/entriesArray.cjs +0 -12
  19. package/lib/entriesArray.d.cts +0 -19
  20. package/lib/entriesArray.d.ts +0 -19
  21. package/lib/entriesArray.js +0 -10
  22. package/lib/isGenericMap.cjs +0 -18
  23. package/lib/isGenericMap.d.cts +0 -6
  24. package/lib/isGenericMap.d.ts +0 -6
  25. package/lib/isGenericMap.js +0 -16
  26. package/lib/keysArray.cjs +0 -12
  27. package/lib/keysArray.d.cts +0 -19
  28. package/lib/keysArray.d.ts +0 -19
  29. package/lib/keysArray.js +0 -10
  30. package/lib/mapGetOrDefault.cjs +0 -18
  31. package/lib/mapGetOrDefault.d.cts +0 -8
  32. package/lib/mapGetOrDefault.d.ts +0 -8
  33. package/lib/mapGetOrDefault.js +0 -16
  34. package/lib/mapLoad.cjs +0 -15
  35. package/lib/mapLoad.d.cts +0 -11
  36. package/lib/mapLoad.d.ts +0 -11
  37. package/lib/mapLoad.js +0 -13
  38. package/lib/mapReverse.cjs +0 -24
  39. package/lib/mapReverse.d.cts +0 -15
  40. package/lib/mapReverse.d.ts +0 -15
  41. package/lib/mapReverse.js +0 -22
  42. package/lib/mapUpdate.cjs +0 -14
  43. package/lib/mapUpdate.d.cts +0 -13
  44. package/lib/mapUpdate.d.ts +0 -13
  45. package/lib/mapUpdate.js +0 -12
  46. package/lib/sort.cjs +0 -17
  47. package/lib/sort.d.cts +0 -25
  48. package/lib/sort.d.ts +0 -25
  49. package/lib/sort.js +0 -15
  50. package/lib/sortByKeys.cjs +0 -19
  51. package/lib/sortByKeys.d.cts +0 -24
  52. package/lib/sortByKeys.d.ts +0 -24
  53. package/lib/sortByKeys.js +0 -17
  54. package/lib/sortByValues.cjs +0 -19
  55. package/lib/sortByValues.d.cts +0 -25
  56. package/lib/sortByValues.d.ts +0 -25
  57. package/lib/sortByValues.js +0 -17
  58. package/lib/toMap.cjs +0 -12
  59. package/lib/toMap.d.cts +0 -20
  60. package/lib/toMap.d.ts +0 -20
  61. package/lib/toMap.js +0 -10
  62. package/lib/valuesArray.cjs +0 -12
  63. package/lib/valuesArray.d.cts +0 -19
  64. package/lib/valuesArray.d.ts +0 -19
  65. package/lib/valuesArray.js +0 -10
package/package.json CHANGED
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "name": "@bemoje/map",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Extended Map class and utilities for sorting, filtering, mapping, and managing key-value data.",
5
+ "type": "module",
6
+ "sideEffects": false,
5
7
  "keywords": [
6
8
  "map",
7
9
  "key-value",
@@ -11,18 +13,15 @@
11
13
  "utilities",
12
14
  "typescript"
13
15
  ],
14
- "dependencies": {
15
- "iter-tools": "^7.5.4",
16
- "mnemonist": "^0.40.3"
17
- },
18
- "type": "module",
19
- "sideEffects": false,
20
- "publishConfig": {
21
- "access": "public"
22
- },
23
16
  "main": "./lib/index.cjs",
24
17
  "module": "./lib/index.js",
25
18
  "types": "./lib/index.d.ts",
19
+ "files": [
20
+ "./lib/index.js",
21
+ "./lib/index.d.ts",
22
+ "./lib/index.cjs",
23
+ "./lib/index.d.cts"
24
+ ],
26
25
  "exports": {
27
26
  ".": {
28
27
  "import": {
@@ -36,230 +35,171 @@
36
35
  },
37
36
  "./ExtMap": {
38
37
  "import": {
39
- "types": "./lib/ExtMap.d.ts",
40
- "default": "./lib/ExtMap.js"
38
+ "types": "./lib/index.d.ts",
39
+ "default": "./lib/index.js"
41
40
  },
42
41
  "require": {
43
- "types": "./lib/ExtMap.d.cts",
44
- "default": "./lib/ExtMap.cjs"
42
+ "types": "./lib/index.d.cts",
43
+ "default": "./lib/index.cjs"
45
44
  }
46
45
  },
47
46
  "./TimeoutWeakMap": {
48
47
  "import": {
49
- "types": "./lib/TimeoutWeakMap.d.ts",
50
- "default": "./lib/TimeoutWeakMap.js"
48
+ "types": "./lib/index.d.ts",
49
+ "default": "./lib/index.js"
51
50
  },
52
51
  "require": {
53
- "types": "./lib/TimeoutWeakMap.d.cts",
54
- "default": "./lib/TimeoutWeakMap.cjs"
52
+ "types": "./lib/index.d.cts",
53
+ "default": "./lib/index.cjs"
55
54
  }
56
55
  },
57
56
  "./countUniques": {
58
57
  "import": {
59
- "types": "./lib/countUniques.d.ts",
60
- "default": "./lib/countUniques.js"
58
+ "types": "./lib/index.d.ts",
59
+ "default": "./lib/index.js"
61
60
  },
62
61
  "require": {
63
- "types": "./lib/countUniques.d.cts",
64
- "default": "./lib/countUniques.cjs"
62
+ "types": "./lib/index.d.cts",
63
+ "default": "./lib/index.cjs"
65
64
  }
66
65
  },
67
66
  "./entriesArray": {
68
67
  "import": {
69
- "types": "./lib/entriesArray.d.ts",
70
- "default": "./lib/entriesArray.js"
68
+ "types": "./lib/index.d.ts",
69
+ "default": "./lib/index.js"
71
70
  },
72
71
  "require": {
73
- "types": "./lib/entriesArray.d.cts",
74
- "default": "./lib/entriesArray.cjs"
72
+ "types": "./lib/index.d.cts",
73
+ "default": "./lib/index.cjs"
75
74
  }
76
75
  },
77
76
  "./isGenericMap": {
78
77
  "import": {
79
- "types": "./lib/isGenericMap.d.ts",
80
- "default": "./lib/isGenericMap.js"
78
+ "types": "./lib/index.d.ts",
79
+ "default": "./lib/index.js"
81
80
  },
82
81
  "require": {
83
- "types": "./lib/isGenericMap.d.cts",
84
- "default": "./lib/isGenericMap.cjs"
82
+ "types": "./lib/index.d.cts",
83
+ "default": "./lib/index.cjs"
85
84
  }
86
85
  },
87
86
  "./keysArray": {
88
87
  "import": {
89
- "types": "./lib/keysArray.d.ts",
90
- "default": "./lib/keysArray.js"
88
+ "types": "./lib/index.d.ts",
89
+ "default": "./lib/index.js"
91
90
  },
92
91
  "require": {
93
- "types": "./lib/keysArray.d.cts",
94
- "default": "./lib/keysArray.cjs"
92
+ "types": "./lib/index.d.cts",
93
+ "default": "./lib/index.cjs"
95
94
  }
96
95
  },
97
96
  "./mapGetOrDefault": {
98
97
  "import": {
99
- "types": "./lib/mapGetOrDefault.d.ts",
100
- "default": "./lib/mapGetOrDefault.js"
98
+ "types": "./lib/index.d.ts",
99
+ "default": "./lib/index.js"
101
100
  },
102
101
  "require": {
103
- "types": "./lib/mapGetOrDefault.d.cts",
104
- "default": "./lib/mapGetOrDefault.cjs"
102
+ "types": "./lib/index.d.cts",
103
+ "default": "./lib/index.cjs"
105
104
  }
106
105
  },
107
106
  "./mapLoad": {
108
107
  "import": {
109
- "types": "./lib/mapLoad.d.ts",
110
- "default": "./lib/mapLoad.js"
108
+ "types": "./lib/index.d.ts",
109
+ "default": "./lib/index.js"
111
110
  },
112
111
  "require": {
113
- "types": "./lib/mapLoad.d.cts",
114
- "default": "./lib/mapLoad.cjs"
112
+ "types": "./lib/index.d.cts",
113
+ "default": "./lib/index.cjs"
115
114
  }
116
115
  },
117
116
  "./mapReverse": {
118
117
  "import": {
119
- "types": "./lib/mapReverse.d.ts",
120
- "default": "./lib/mapReverse.js"
118
+ "types": "./lib/index.d.ts",
119
+ "default": "./lib/index.js"
121
120
  },
122
121
  "require": {
123
- "types": "./lib/mapReverse.d.cts",
124
- "default": "./lib/mapReverse.cjs"
122
+ "types": "./lib/index.d.cts",
123
+ "default": "./lib/index.cjs"
125
124
  }
126
125
  },
127
126
  "./mapUpdate": {
128
127
  "import": {
129
- "types": "./lib/mapUpdate.d.ts",
130
- "default": "./lib/mapUpdate.js"
128
+ "types": "./lib/index.d.ts",
129
+ "default": "./lib/index.js"
131
130
  },
132
131
  "require": {
133
- "types": "./lib/mapUpdate.d.cts",
134
- "default": "./lib/mapUpdate.cjs"
132
+ "types": "./lib/index.d.cts",
133
+ "default": "./lib/index.cjs"
135
134
  }
136
135
  },
137
136
  "./sort": {
138
137
  "import": {
139
- "types": "./lib/sort.d.ts",
140
- "default": "./lib/sort.js"
138
+ "types": "./lib/index.d.ts",
139
+ "default": "./lib/index.js"
141
140
  },
142
141
  "require": {
143
- "types": "./lib/sort.d.cts",
144
- "default": "./lib/sort.cjs"
142
+ "types": "./lib/index.d.cts",
143
+ "default": "./lib/index.cjs"
145
144
  }
146
145
  },
147
146
  "./sortByKeys": {
148
147
  "import": {
149
- "types": "./lib/sortByKeys.d.ts",
150
- "default": "./lib/sortByKeys.js"
148
+ "types": "./lib/index.d.ts",
149
+ "default": "./lib/index.js"
151
150
  },
152
151
  "require": {
153
- "types": "./lib/sortByKeys.d.cts",
154
- "default": "./lib/sortByKeys.cjs"
152
+ "types": "./lib/index.d.cts",
153
+ "default": "./lib/index.cjs"
155
154
  }
156
155
  },
157
156
  "./sortByValues": {
158
157
  "import": {
159
- "types": "./lib/sortByValues.d.ts",
160
- "default": "./lib/sortByValues.js"
158
+ "types": "./lib/index.d.ts",
159
+ "default": "./lib/index.js"
161
160
  },
162
161
  "require": {
163
- "types": "./lib/sortByValues.d.cts",
164
- "default": "./lib/sortByValues.cjs"
162
+ "types": "./lib/index.d.cts",
163
+ "default": "./lib/index.cjs"
165
164
  }
166
165
  },
167
166
  "./toMap": {
168
167
  "import": {
169
- "types": "./lib/toMap.d.ts",
170
- "default": "./lib/toMap.js"
168
+ "types": "./lib/index.d.ts",
169
+ "default": "./lib/index.js"
171
170
  },
172
171
  "require": {
173
- "types": "./lib/toMap.d.cts",
174
- "default": "./lib/toMap.cjs"
172
+ "types": "./lib/index.d.cts",
173
+ "default": "./lib/index.cjs"
175
174
  }
176
175
  },
177
176
  "./valuesArray": {
178
177
  "import": {
179
- "types": "./lib/valuesArray.d.ts",
180
- "default": "./lib/valuesArray.js"
178
+ "types": "./lib/index.d.ts",
179
+ "default": "./lib/index.js"
181
180
  },
182
181
  "require": {
183
- "types": "./lib/valuesArray.d.cts",
184
- "default": "./lib/valuesArray.cjs"
182
+ "types": "./lib/index.d.cts",
183
+ "default": "./lib/index.cjs"
185
184
  }
186
185
  }
187
186
  },
188
- "files": [
189
- "./lib/index.js",
190
- "./lib/index.d.ts",
191
- "./lib/index.cjs",
192
- "./lib/index.d.cts",
193
- "./lib/ExtMap.js",
194
- "./lib/ExtMap.d.ts",
195
- "./lib/ExtMap.cjs",
196
- "./lib/ExtMap.d.cts",
197
- "./lib/TimeoutWeakMap.js",
198
- "./lib/TimeoutWeakMap.d.ts",
199
- "./lib/TimeoutWeakMap.cjs",
200
- "./lib/TimeoutWeakMap.d.cts",
201
- "./lib/countUniques.js",
202
- "./lib/countUniques.d.ts",
203
- "./lib/countUniques.cjs",
204
- "./lib/countUniques.d.cts",
205
- "./lib/entriesArray.js",
206
- "./lib/entriesArray.d.ts",
207
- "./lib/entriesArray.cjs",
208
- "./lib/entriesArray.d.cts",
209
- "./lib/isGenericMap.js",
210
- "./lib/isGenericMap.d.ts",
211
- "./lib/isGenericMap.cjs",
212
- "./lib/isGenericMap.d.cts",
213
- "./lib/keysArray.js",
214
- "./lib/keysArray.d.ts",
215
- "./lib/keysArray.cjs",
216
- "./lib/keysArray.d.cts",
217
- "./lib/mapGetOrDefault.js",
218
- "./lib/mapGetOrDefault.d.ts",
219
- "./lib/mapGetOrDefault.cjs",
220
- "./lib/mapGetOrDefault.d.cts",
221
- "./lib/mapLoad.js",
222
- "./lib/mapLoad.d.ts",
223
- "./lib/mapLoad.cjs",
224
- "./lib/mapLoad.d.cts",
225
- "./lib/mapReverse.js",
226
- "./lib/mapReverse.d.ts",
227
- "./lib/mapReverse.cjs",
228
- "./lib/mapReverse.d.cts",
229
- "./lib/mapUpdate.js",
230
- "./lib/mapUpdate.d.ts",
231
- "./lib/mapUpdate.cjs",
232
- "./lib/mapUpdate.d.cts",
233
- "./lib/sort.js",
234
- "./lib/sort.d.ts",
235
- "./lib/sort.cjs",
236
- "./lib/sort.d.cts",
237
- "./lib/sortByKeys.js",
238
- "./lib/sortByKeys.d.ts",
239
- "./lib/sortByKeys.cjs",
240
- "./lib/sortByKeys.d.cts",
241
- "./lib/sortByValues.js",
242
- "./lib/sortByValues.d.ts",
243
- "./lib/sortByValues.cjs",
244
- "./lib/sortByValues.d.cts",
245
- "./lib/toMap.js",
246
- "./lib/toMap.d.ts",
247
- "./lib/toMap.cjs",
248
- "./lib/toMap.d.cts",
249
- "./lib/valuesArray.js",
250
- "./lib/valuesArray.d.ts",
251
- "./lib/valuesArray.cjs",
252
- "./lib/valuesArray.d.cts"
253
- ],
254
- "repository": {
255
- "type": "git",
256
- "url": "git+https://github.com/bemoje/mono.git",
257
- "directory": "libs/map"
187
+ "dependencies": {
188
+ "iter-tools": "^7.5.4",
189
+ "mnemonist": "^0.40.3"
258
190
  },
191
+ "publishConfig": {
192
+ "access": "public"
193
+ },
194
+ "license": "MIT",
259
195
  "author": {
260
196
  "name": "Benjamin Møller Jensen",
261
197
  "email": "bemoje@bemoje.net",
262
198
  "url": "https://github.com/bemoje/"
263
199
  },
264
- "license": "MIT"
200
+ "repository": {
201
+ "type": "git",
202
+ "url": "git+https://github.com/bemoje/mono.git",
203
+ "directory": "libs/map"
204
+ }
265
205
  }
package/lib/ExtMap.cjs DELETED
@@ -1,354 +0,0 @@
1
- 'use strict';
2
-
3
- var iterTools = require('iter-tools');
4
- var util = require('util');
5
-
6
- var __defProp = Object.defineProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
-
9
- // ../object/src/defineMethod.ts
10
- function defineMethod(obj, key, value, des = {}) {
11
- return Object.defineProperty(obj, key, {
12
- value,
13
- configurable: true,
14
- writable: true,
15
- enumerable: false,
16
- ...des
17
- });
18
- }
19
- __name(defineMethod, "defineMethod");
20
-
21
- // ../object/src/entriesOf.ts
22
- function entriesOf(obj) {
23
- return Object.entries(obj);
24
- }
25
- __name(entriesOf, "entriesOf");
26
-
27
- // ../composition/src/View.ts
28
- var TARGET_SYMBOL = /* @__PURE__ */ Symbol("target");
29
- var View = class {
30
- static {
31
- __name(this, "View");
32
- }
33
- [TARGET_SYMBOL];
34
- constructor(target) {
35
- this[TARGET_SYMBOL] = target;
36
- }
37
- get [Symbol.toStringTag]() {
38
- return this.constructor.name;
39
- }
40
- get target() {
41
- return this[TARGET_SYMBOL];
42
- }
43
- };
44
-
45
- // ../composition/src/inheritProxifiedPrototypeProperty.ts
46
- function inheritProxifiedPrototypeProperty(ViewerClass, TargetClass, key) {
47
- const des = Reflect.getOwnPropertyDescriptor(TargetClass.prototype, key);
48
- if (!des) {
49
- return;
50
- }
51
- if (des.value && typeof des.value === "function") {
52
- return Object.defineProperty(ViewerClass.prototype, key, {
53
- value(...args) {
54
- return this.target[key](...args);
55
- },
56
- writable: true,
57
- configurable: true,
58
- enumerable: false
59
- });
60
- } else if (des && !des.get && !des.set) {
61
- return Object.defineProperty(ViewerClass.prototype, key, {
62
- get() {
63
- return this.target[key];
64
- },
65
- set: des.writable ? /* @__PURE__ */ __name(function set(value) {
66
- this.target[key] = value;
67
- }, "set") : void 0,
68
- configurable: true,
69
- enumerable: false
70
- });
71
- } else {
72
- Object.defineProperty(ViewerClass.prototype, key, {
73
- get: des.get ? function() {
74
- return this.target[key];
75
- } : void 0,
76
- set: des.set ? function(value) {
77
- this.target[key] = value;
78
- } : void 0,
79
- configurable: true,
80
- enumerable: false
81
- });
82
- }
83
- }
84
- __name(inheritProxifiedPrototypeProperty, "inheritProxifiedPrototypeProperty");
85
-
86
- // ../composition/src/inheritProxifiedPrototype.ts
87
- function inheritProxifiedPrototype(ViewerClass, TargetClass, omitKeys) {
88
- Reflect.ownKeys(TargetClass.prototype).filter((k) => {
89
- return k !== "constructor" && k !== Symbol.toStringTag;
90
- }).filter((k) => {
91
- return omitKeys ? !omitKeys.includes(k) : true;
92
- }).forEach((k) => {
93
- return inheritProxifiedPrototypeProperty(ViewerClass, TargetClass, k);
94
- });
95
- return ViewerClass;
96
- }
97
- __name(inheritProxifiedPrototype, "inheritProxifiedPrototype");
98
-
99
- // src/entriesArray.ts
100
- function entriesArray(ins) {
101
- return Array.from(ins);
102
- }
103
- __name(entriesArray, "entriesArray");
104
- function filterIterableValues(mapLike, predicate) {
105
- return iterTools.filter(([k, v]) => {
106
- return predicate(v, k);
107
- }, mapLike);
108
- }
109
- __name(filterIterableValues, "filterIterableValues");
110
-
111
- // src/keysArray.ts
112
- function keysArray(ins) {
113
- return Array.from(ins.keys());
114
- }
115
- __name(keysArray, "keysArray");
116
-
117
- // src/mapGetOrDefault.ts
118
- function mapGetOrDefault(map3, key, factory) {
119
- let value = map3.get(key);
120
- if (value !== void 0 || map3.has(key)) {
121
- return value;
122
- }
123
- value = factory(key, map3);
124
- map3.set(key, value);
125
- return value;
126
- }
127
- __name(mapGetOrDefault, "mapGetOrDefault");
128
- function mapIterableKeys(mapLike, mapper) {
129
- return iterTools.map(([k, v]) => {
130
- return [
131
- mapper(k, v),
132
- v
133
- ];
134
- }, mapLike);
135
- }
136
- __name(mapIterableKeys, "mapIterableKeys");
137
- function mapIterableValues(mapLike, mapper) {
138
- return iterTools.map(([k, v]) => {
139
- return [
140
- k,
141
- mapper(v, k)
142
- ];
143
- }, mapLike);
144
- }
145
- __name(mapIterableValues, "mapIterableValues");
146
-
147
- // src/mapLoad.ts
148
- function mapLoad(ins, entries) {
149
- for (const [key, value] of entries) {
150
- ins.set(key, value);
151
- }
152
- return ins;
153
- }
154
- __name(mapLoad, "mapLoad");
155
-
156
- // src/mapReverse.ts
157
- function mapReverse(ins) {
158
- const entries = Array.from(ins).reverse();
159
- ins.clear();
160
- mapLoad(ins, entries);
161
- return ins;
162
- }
163
- __name(mapReverse, "mapReverse");
164
-
165
- // src/mapUpdate.ts
166
- function mapUpdate(ins, key, update) {
167
- const newValue = update(ins.get(key), key, ins);
168
- ins.set(key, newValue);
169
- return ins;
170
- }
171
- __name(mapUpdate, "mapUpdate");
172
-
173
- // ../iter/src/reduceIterableValues.ts
174
- function reduceIterableValues(mapLike, reducer, initial) {
175
- let accumulator = initial;
176
- for (const [k, v] of mapLike) {
177
- accumulator = reducer(accumulator, v, k);
178
- }
179
- return accumulator;
180
- }
181
- __name(reduceIterableValues, "reduceIterableValues");
182
-
183
- // src/sort.ts
184
- function sort(ins, compare) {
185
- const entries = Array.from(ins).sort(compare);
186
- ins.clear();
187
- for (const [k, v] of entries) {
188
- ins.set(k, v);
189
- }
190
- return ins;
191
- }
192
- __name(sort, "sort");
193
-
194
- // src/sortByKeys.ts
195
- function sortByKeys(ins, compare) {
196
- const entries = Array.from(ins).sort((a, b) => {
197
- return compare(a[0], b[0]);
198
- });
199
- ins.clear();
200
- for (const [k, v] of entries) {
201
- ins.set(k, v);
202
- }
203
- return ins;
204
- }
205
- __name(sortByKeys, "sortByKeys");
206
-
207
- // src/sortByValues.ts
208
- function sortByValues(ins, compare) {
209
- const entries = Array.from(ins).sort((a, b) => {
210
- return compare(a[1], b[1]);
211
- });
212
- ins.clear();
213
- for (const [k, v] of entries) {
214
- ins.set(k, v);
215
- }
216
- return ins;
217
- }
218
- __name(sortByValues, "sortByValues");
219
-
220
- // ../fn/src/setNameAndLength.ts
221
- function setNameAndLength(source, target, lengthDelta = 0) {
222
- return Object.defineProperties(target, {
223
- name: {
224
- configurable: true,
225
- value: source.name
226
- },
227
- length: {
228
- configurable: true,
229
- value: source.length + lengthDelta
230
- }
231
- });
232
- }
233
- __name(setNameAndLength, "setNameAndLength");
234
-
235
- // ../fn/src/thisify.ts
236
- function thisify(fn) {
237
- return setNameAndLength(fn, /* @__PURE__ */ __name(function f(...args) {
238
- return fn(this, ...args);
239
- }, "f"), -1);
240
- }
241
- __name(thisify, "thisify");
242
-
243
- // src/toMap.ts
244
- function toMap(ins) {
245
- return new Map(ins);
246
- }
247
- __name(toMap, "toMap");
248
-
249
- // ../iter/src/toObjectIterable.ts
250
- function toObjectIterable(mapLike) {
251
- const object = {};
252
- for (const [key, value] of mapLike) {
253
- if (typeof key !== "string" && typeof key !== "number" && typeof key !== "symbol") {
254
- object[String(key)] = value;
255
- } else {
256
- object[key] = value;
257
- }
258
- }
259
- return object;
260
- }
261
- __name(toObjectIterable, "toObjectIterable");
262
-
263
- // ../fn/src/transformReturnValue.ts
264
- function transformReturnValue(fn, transform) {
265
- return setNameAndLength(fn, function(...args) {
266
- const result = fn.apply(this, args);
267
- return transform(result);
268
- });
269
- }
270
- __name(transformReturnValue, "transformReturnValue");
271
-
272
- // src/valuesArray.ts
273
- function valuesArray(ins) {
274
- return Array.from(ins.values());
275
- }
276
- __name(valuesArray, "valuesArray");
277
-
278
- // src/ExtMap.ts
279
- var ExtMap = class _ExtMap extends View {
280
- static {
281
- __name(this, "ExtMap");
282
- }
283
- constructor(arg) {
284
- super(new Map(iterTools.isIterable(arg) ? arg : arg ? entriesOf(arg) : void 0));
285
- }
286
- /**
287
- * Creates a new ExtMap instance from a regular object.
288
- *
289
- * @param obj - An object whose key-value pairs will be used to initialize the map
290
- * @returns A new ExtMap instance containing the entries from the object
291
- */
292
- static fromObject(obj) {
293
- return new _ExtMap(Object.entries(obj));
294
- }
295
- /**
296
- * Creates a new ExtMap instance from an iterable of key-value pairs.
297
- *
298
- * @param entries - An iterable of key-value pairs to initialize the map
299
- * @returns A new ExtMap instance containing the provided entries
300
- */
301
- static fromIterable(entries) {
302
- return new _ExtMap(entries);
303
- }
304
- /**
305
- * Creates a shallow copy of the map.
306
- *
307
- * @returns A new ExtMap instance with the same entries
308
- */
309
- clone() {
310
- return new _ExtMap(this);
311
- }
312
- /**
313
- * Converts the map to a JSON-serializable format.
314
- *
315
- * @returns Array of key-value pairs suitable for JSON serialization
316
- */
317
- toJSON() {
318
- return [
319
- ...this.entries()
320
- ];
321
- }
322
- /**
323
- * Custom inspection method for better debugging output.
324
- *
325
- * @param _depth - The depth of inspection
326
- * @param _options - Options for inspection
327
- * @returns A string representation of the map
328
- */
329
- [util.inspect.custom](_depth, _options) {
330
- return util.inspect(this.target, {
331
- breakLength: 50
332
- });
333
- }
334
- };
335
- inheritProxifiedPrototype(ExtMap, Map, []);
336
- defineMethod(ExtMap.prototype, "load", thisify(mapLoad));
337
- defineMethod(ExtMap.prototype, "sort", thisify(sort));
338
- defineMethod(ExtMap.prototype, "sortByKeys", thisify(sortByKeys));
339
- defineMethod(ExtMap.prototype, "sortByValues", thisify(sortByValues));
340
- defineMethod(ExtMap.prototype, "reverse", thisify(mapReverse));
341
- defineMethod(ExtMap.prototype, "update", thisify(mapUpdate));
342
- defineMethod(ExtMap.prototype, "getOrDefault", thisify(mapGetOrDefault));
343
- defineMethod(ExtMap.prototype, "keysArray", thisify(keysArray));
344
- defineMethod(ExtMap.prototype, "valuesArray", thisify(valuesArray));
345
- defineMethod(ExtMap.prototype, "entriesArray", thisify(entriesArray));
346
- defineMethod(ExtMap.prototype, "toObject", thisify(toObjectIterable));
347
- defineMethod(ExtMap.prototype, "toMap", thisify(toMap));
348
- defineMethod(ExtMap.prototype, "reduce", thisify(reduceIterableValues));
349
- defineMethod(ExtMap.prototype, "map", thisify(transformReturnValue(mapIterableValues, ExtMap.fromIterable)));
350
- defineMethod(ExtMap.prototype, "mapKeys", thisify(transformReturnValue(mapIterableKeys, ExtMap.fromIterable)));
351
- defineMethod(ExtMap.prototype, "mapValues", thisify(transformReturnValue(mapIterableValues, ExtMap.fromIterable)));
352
- defineMethod(ExtMap.prototype, "filter", thisify(transformReturnValue(filterIterableValues, ExtMap.fromIterable)));
353
-
354
- exports.ExtMap = ExtMap;