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