@bemoje/map 2.1.0 → 2.1.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.cjs CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  var iterTools = require('iter-tools');
4
4
  var util = require('util');
5
- var fn = require('@bemoje/fn');
6
5
  var mnemonist = require('mnemonist');
7
6
 
8
7
  var __defProp = Object.defineProperty;
@@ -217,6 +216,38 @@ function sortByValues(ins, compare) {
217
216
  }
218
217
  __name(sortByValues, "sortByValues");
219
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
+ // ../fn/src/transformReturnValue.ts
243
+ function transformReturnValue(fn, transform) {
244
+ return setNameAndLength(fn, function(...args) {
245
+ const result = fn.apply(this, args);
246
+ return transform(result);
247
+ });
248
+ }
249
+ __name(transformReturnValue, "transformReturnValue");
250
+
220
251
  // src/toMap.ts
221
252
  function toMap(ins) {
222
253
  return new Map(ins);
@@ -287,23 +318,23 @@ var ExtMap = class _ExtMap extends View {
287
318
  }
288
319
  };
289
320
  inheritProxifiedPrototype(ExtMap, Map, []);
290
- defineMethod(ExtMap.prototype, "load", fn.thisify(mapLoad));
291
- defineMethod(ExtMap.prototype, "sort", fn.thisify(sort));
292
- defineMethod(ExtMap.prototype, "sortByKeys", fn.thisify(sortByKeys));
293
- defineMethod(ExtMap.prototype, "sortByValues", fn.thisify(sortByValues));
294
- defineMethod(ExtMap.prototype, "reverse", fn.thisify(mapReverse));
295
- defineMethod(ExtMap.prototype, "update", fn.thisify(mapUpdate));
296
- defineMethod(ExtMap.prototype, "getOrDefault", fn.thisify(mapGetOrDefault));
297
- defineMethod(ExtMap.prototype, "keysArray", fn.thisify(keysArray));
298
- defineMethod(ExtMap.prototype, "valuesArray", fn.thisify(valuesArray));
299
- defineMethod(ExtMap.prototype, "entriesArray", fn.thisify(entriesArray));
300
- defineMethod(ExtMap.prototype, "toObject", fn.thisify(toObjectIterable));
301
- defineMethod(ExtMap.prototype, "toMap", fn.thisify(toMap));
302
- defineMethod(ExtMap.prototype, "reduce", fn.thisify(reduceIterableValues));
303
- defineMethod(ExtMap.prototype, "map", fn.thisify(fn.transformReturnValue(mapIterableValues, ExtMap.fromIterable)));
304
- defineMethod(ExtMap.prototype, "mapKeys", fn.thisify(fn.transformReturnValue(mapIterableKeys, ExtMap.fromIterable)));
305
- defineMethod(ExtMap.prototype, "mapValues", fn.thisify(fn.transformReturnValue(mapIterableValues, ExtMap.fromIterable)));
306
- defineMethod(ExtMap.prototype, "filter", fn.thisify(fn.transformReturnValue(filterIterableValues, ExtMap.fromIterable)));
321
+ defineMethod(ExtMap.prototype, "load", thisify(mapLoad));
322
+ defineMethod(ExtMap.prototype, "sort", thisify(sort));
323
+ defineMethod(ExtMap.prototype, "sortByKeys", thisify(sortByKeys));
324
+ defineMethod(ExtMap.prototype, "sortByValues", thisify(sortByValues));
325
+ defineMethod(ExtMap.prototype, "reverse", thisify(mapReverse));
326
+ defineMethod(ExtMap.prototype, "update", thisify(mapUpdate));
327
+ defineMethod(ExtMap.prototype, "getOrDefault", thisify(mapGetOrDefault));
328
+ defineMethod(ExtMap.prototype, "keysArray", thisify(keysArray));
329
+ defineMethod(ExtMap.prototype, "valuesArray", thisify(valuesArray));
330
+ defineMethod(ExtMap.prototype, "entriesArray", thisify(entriesArray));
331
+ defineMethod(ExtMap.prototype, "toObject", thisify(toObjectIterable));
332
+ defineMethod(ExtMap.prototype, "toMap", thisify(toMap));
333
+ defineMethod(ExtMap.prototype, "reduce", thisify(reduceIterableValues));
334
+ defineMethod(ExtMap.prototype, "map", thisify(transformReturnValue(mapIterableValues, ExtMap.fromIterable)));
335
+ defineMethod(ExtMap.prototype, "mapKeys", thisify(transformReturnValue(mapIterableKeys, ExtMap.fromIterable)));
336
+ defineMethod(ExtMap.prototype, "mapValues", thisify(transformReturnValue(mapIterableValues, ExtMap.fromIterable)));
337
+ defineMethod(ExtMap.prototype, "filter", thisify(transformReturnValue(filterIterableValues, ExtMap.fromIterable)));
307
338
 
308
339
  // src/TimeoutWeakMap.ts
309
340
  var TimeoutWeakMap = class {
package/lib/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { isIterable, map, filter, reduce } from 'iter-tools';
2
2
  import { inspect } from 'util';
3
- import { thisify, transformReturnValue } from '@bemoje/fn';
4
3
  import { MultiSet } from 'mnemonist';
5
4
 
6
5
  var __defProp = Object.defineProperty;
@@ -215,6 +214,38 @@ function sortByValues(ins, compare) {
215
214
  }
216
215
  __name(sortByValues, "sortByValues");
217
216
 
217
+ // ../fn/src/setNameAndLength.ts
218
+ function setNameAndLength(source, target, lengthDelta = 0) {
219
+ return Object.defineProperties(target, {
220
+ name: {
221
+ configurable: true,
222
+ value: source.name
223
+ },
224
+ length: {
225
+ configurable: true,
226
+ value: source.length + lengthDelta
227
+ }
228
+ });
229
+ }
230
+ __name(setNameAndLength, "setNameAndLength");
231
+
232
+ // ../fn/src/thisify.ts
233
+ function thisify(fn) {
234
+ return setNameAndLength(fn, /* @__PURE__ */ __name(function f(...args) {
235
+ return fn(this, ...args);
236
+ }, "f"), -1);
237
+ }
238
+ __name(thisify, "thisify");
239
+
240
+ // ../fn/src/transformReturnValue.ts
241
+ function transformReturnValue(fn, transform) {
242
+ return setNameAndLength(fn, function(...args) {
243
+ const result = fn.apply(this, args);
244
+ return transform(result);
245
+ });
246
+ }
247
+ __name(transformReturnValue, "transformReturnValue");
248
+
218
249
  // src/toMap.ts
219
250
  function toMap(ins) {
220
251
  return new Map(ins);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bemoje/map",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Extended Map class and utilities for sorting, filtering, mapping, and managing key-value data.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -8,7 +8,6 @@
8
8
  "access": "public"
9
9
  },
10
10
  "dependencies": {
11
- "@bemoje/fn": "^2.0.0",
12
11
  "iter-tools": "^7.5.4",
13
12
  "mnemonist": "^0.40.3"
14
13
  },