@bemoje/map 1.2.0 → 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/index.js CHANGED
@@ -1,15 +1,489 @@
1
- export * from './ExtMap';
2
- export * from './TimeoutWeakMap';
3
- export * from './countUniques';
4
- export * from './entriesArray';
5
- export * from './isGenericMap';
6
- export * from './keysArray';
7
- export * from './mapGetOrDefault';
8
- export * from './mapLoad';
9
- export * from './mapReverse';
10
- export * from './mapUpdate';
11
- export * from './sort';
12
- export * from './sortByKeys';
13
- export * from './sortByValues';
14
- export * from './toMap';
15
- export * from './valuesArray';
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
+
353
+ // src/TimeoutWeakMap.ts
354
+ var TimeoutWeakMap = class {
355
+ static {
356
+ __name(this, "TimeoutWeakMap");
357
+ }
358
+ timeoutMs;
359
+ wmap = /* @__PURE__ */ new WeakMap();
360
+ /**
361
+ * @param timeoutMs Default timeout in milliseconds for entries
362
+ */
363
+ constructor(timeoutMs) {
364
+ this.timeoutMs = timeoutMs;
365
+ }
366
+ /**
367
+ * Retrieves the value for the given key and refreshes its timeout.
368
+ *
369
+ * @param key The key to retrieve
370
+ * @returns The value if found, undefined otherwise
371
+ */
372
+ get(key) {
373
+ const vt = this.wmap.get(key);
374
+ if (!vt) {
375
+ return void 0;
376
+ }
377
+ const [value, timeout] = vt;
378
+ timeout.refresh();
379
+ return value;
380
+ }
381
+ /**
382
+ * Sets a key-value pair with an optional custom timeout.
383
+ *
384
+ * @param key The key to set
385
+ * @param value The value to associate with the key
386
+ * @param timeoutMs Optional timeout override for this entry
387
+ * @returns This instance for chaining
388
+ */
389
+ set(key, value, timeoutMs) {
390
+ this.wmap.set(key, [
391
+ value,
392
+ setTimeout(() => {
393
+ this.delete(key);
394
+ }, timeoutMs ?? this.timeoutMs).unref()
395
+ ]);
396
+ return this;
397
+ }
398
+ /**
399
+ * Removes a key-value pair and clears its timeout.
400
+ *
401
+ * @param key The key to delete
402
+ * @returns True if the key existed and was deleted, false otherwise
403
+ */
404
+ delete(key) {
405
+ const vt = this.wmap.get(key);
406
+ if (!vt) {
407
+ return false;
408
+ }
409
+ const timeout = vt[1];
410
+ clearTimeout(timeout);
411
+ return this.wmap.delete(key);
412
+ }
413
+ /**
414
+ * Checks if a key exists in the map.
415
+ * Does not refresh the timeout.
416
+ *
417
+ * @param key The key to check
418
+ * @returns True if the key exists, false otherwise
419
+ */
420
+ has(key) {
421
+ return this.wmap.has(key);
422
+ }
423
+ /**
424
+ * Loads multiple key-value pairs into the map.
425
+ *
426
+ * @param entries Iterable of key-value pairs to load
427
+ * @param timeoutMs Optional timeout override for all entries
428
+ * @returns This instance for chaining
429
+ */
430
+ load(entries, timeoutMs) {
431
+ for (const [key, value] of entries) {
432
+ this.set(key, value, timeoutMs);
433
+ }
434
+ return this;
435
+ }
436
+ /**
437
+ * Updates an existing value or creates a new one using an update function.
438
+ *
439
+ * @param key The key to update
440
+ * @param update Function that receives the current value and returns the new value
441
+ * @returns This instance for chaining
442
+ */
443
+ update(key, update) {
444
+ return this.set(key, update(this.get(key), key, this));
445
+ }
446
+ /**
447
+ * Gets a value or creates it using a factory function if it doesn't exist.
448
+ * Refreshes timeout if the value exists.
449
+ *
450
+ * @param key The key to get or create
451
+ * @param factory Function to create the value if it doesn't exist
452
+ * @param timeoutMs Optional timeout override for new entries
453
+ * @returns The existing or newly created value
454
+ */
455
+ getOrDefault(key, factory, timeoutMs) {
456
+ const vt = this.wmap.get(key);
457
+ if (vt) {
458
+ const [value, timeout] = vt;
459
+ timeout.refresh();
460
+ return value;
461
+ } else {
462
+ const value = factory(key, this);
463
+ this.set(key, value, timeoutMs);
464
+ return value;
465
+ }
466
+ }
467
+ };
468
+ function countUniques(input) {
469
+ return new ExtMap(reduce(new MultiSet(), (acc, imp) => {
470
+ return acc.add(imp);
471
+ }, input).multiplicities()).sortByValues((a, b) => {
472
+ return b - a;
473
+ });
474
+ }
475
+ __name(countUniques, "countUniques");
476
+
477
+ // src/isGenericMap.ts
478
+ function isGenericMap(target, requiredProps = [
479
+ "get",
480
+ "set",
481
+ "has"
482
+ ]) {
483
+ return !!target && requiredProps.every((prop) => {
484
+ return typeof target[prop] === typeof Map.prototype[prop];
485
+ });
486
+ }
487
+ __name(isGenericMap, "isGenericMap");
488
+
489
+ export { ExtMap, TimeoutWeakMap, countUniques, entriesArray, isGenericMap, keysArray, mapGetOrDefault, mapLoad, mapReverse, mapUpdate, sort, sortByKeys, sortByValues, toMap, valuesArray };
@@ -2,6 +2,8 @@
2
2
 
3
3
  var __defProp = Object.defineProperty;
4
4
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+
6
+ // src/isGenericMap.ts
5
7
  function isGenericMap(target, requiredProps = [
6
8
  "get",
7
9
  "set",
@@ -1,5 +1,7 @@
1
- import { __name } from './chunk-SHUYVCID.js';
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
2
3
 
4
+ // src/isGenericMap.ts
3
5
  function isGenericMap(target, requiredProps = [
4
6
  "get",
5
7
  "set",
package/lib/keysArray.cjs CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  var __defProp = Object.defineProperty;
4
4
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+
6
+ // src/keysArray.ts
5
7
  function keysArray(ins) {
6
8
  return Array.from(ins.keys());
7
9
  }
package/lib/keysArray.js CHANGED
@@ -1,5 +1,7 @@
1
- import { __name } from './chunk-SHUYVCID.js';
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
2
3
 
4
+ // src/keysArray.ts
3
5
  function keysArray(ins) {
4
6
  return Array.from(ins.keys());
5
7
  }
@@ -2,6 +2,8 @@
2
2
 
3
3
  var __defProp = Object.defineProperty;
4
4
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+
6
+ // src/mapGetOrDefault.ts
5
7
  function mapGetOrDefault(map, key, factory) {
6
8
  let value = map.get(key);
7
9
  if (value !== void 0 || map.has(key)) {
@@ -1,5 +1,7 @@
1
- import { __name } from './chunk-SHUYVCID.js';
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
2
3
 
4
+ // src/mapGetOrDefault.ts
3
5
  function mapGetOrDefault(map, key, factory) {
4
6
  let value = map.get(key);
5
7
  if (value !== void 0 || map.has(key)) {
package/lib/mapLoad.cjs CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  var __defProp = Object.defineProperty;
4
4
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+
6
+ // src/mapLoad.ts
5
7
  function mapLoad(ins, entries) {
6
8
  for (const [key, value] of entries) {
7
9
  ins.set(key, value);
package/lib/mapLoad.js CHANGED
@@ -1,5 +1,7 @@
1
- import { __name } from './chunk-SHUYVCID.js';
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
2
3
 
4
+ // src/mapLoad.ts
3
5
  function mapLoad(ins, entries) {
4
6
  for (const [key, value] of entries) {
5
7
  ins.set(key, value);
@@ -1,13 +1,22 @@
1
1
  'use strict';
2
2
 
3
- var mapLoad = require('./mapLoad');
4
-
5
3
  var __defProp = Object.defineProperty;
6
4
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+
6
+ // src/mapLoad.ts
7
+ function mapLoad(ins, entries) {
8
+ for (const [key, value] of entries) {
9
+ ins.set(key, value);
10
+ }
11
+ return ins;
12
+ }
13
+ __name(mapLoad, "mapLoad");
14
+
15
+ // src/mapReverse.ts
7
16
  function mapReverse(ins) {
8
17
  const entries = Array.from(ins).reverse();
9
18
  ins.clear();
10
- mapLoad.mapLoad(ins, entries);
19
+ mapLoad(ins, entries);
11
20
  return ins;
12
21
  }
13
22
  __name(mapReverse, "mapReverse");
package/lib/mapReverse.js CHANGED
@@ -1,6 +1,16 @@
1
- import { __name } from './chunk-SHUYVCID.js';
2
- import { mapLoad } from './mapLoad';
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
+ // src/mapLoad.ts
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
+ // src/mapReverse.ts
4
14
  function mapReverse(ins) {
5
15
  const entries = Array.from(ins).reverse();
6
16
  ins.clear();
package/lib/mapUpdate.cjs CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  var __defProp = Object.defineProperty;
4
4
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+
6
+ // src/mapUpdate.ts
5
7
  function mapUpdate(ins, key, update) {
6
8
  const newValue = update(ins.get(key), key, ins);
7
9
  ins.set(key, newValue);
package/lib/mapUpdate.js CHANGED
@@ -1,5 +1,7 @@
1
- import { __name } from './chunk-SHUYVCID.js';
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
2
3
 
4
+ // src/mapUpdate.ts
3
5
  function mapUpdate(ins, key, update) {
4
6
  const newValue = update(ins.get(key), key, ins);
5
7
  ins.set(key, newValue);
package/lib/sort.cjs CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  var __defProp = Object.defineProperty;
4
4
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+
6
+ // src/sort.ts
5
7
  function sort(ins, compare) {
6
8
  const entries = Array.from(ins).sort(compare);
7
9
  ins.clear();
package/lib/sort.js CHANGED
@@ -1,5 +1,7 @@
1
- import { __name } from './chunk-SHUYVCID.js';
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
2
3
 
4
+ // src/sort.ts
3
5
  function sort(ins, compare) {
4
6
  const entries = Array.from(ins).sort(compare);
5
7
  ins.clear();
@@ -2,6 +2,8 @@
2
2
 
3
3
  var __defProp = Object.defineProperty;
4
4
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+
6
+ // src/sortByKeys.ts
5
7
  function sortByKeys(ins, compare) {
6
8
  const entries = Array.from(ins).sort((a, b) => {
7
9
  return compare(a[0], b[0]);
package/lib/sortByKeys.js CHANGED
@@ -1,5 +1,7 @@
1
- import { __name } from './chunk-SHUYVCID.js';
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
2
3
 
4
+ // src/sortByKeys.ts
3
5
  function sortByKeys(ins, compare) {
4
6
  const entries = Array.from(ins).sort((a, b) => {
5
7
  return compare(a[0], b[0]);