@naturalcycles/js-lib 14.241.0 → 14.241.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.
Files changed (74) hide show
  1. package/dist/abort.js +1 -2
  2. package/dist/array/array.util.js +39 -40
  3. package/dist/array/range.js +3 -4
  4. package/dist/datetime/localDate.js +2 -2
  5. package/dist/datetime/localTime.js +2 -2
  6. package/dist/decorators/asyncMemo.decorator.js +2 -2
  7. package/dist/decorators/createPromiseDecorator.js +1 -2
  8. package/dist/decorators/debounce.decorator.js +2 -3
  9. package/dist/decorators/debounce.js +2 -3
  10. package/dist/decorators/decorator.util.js +3 -4
  11. package/dist/decorators/logMethod.decorator.js +1 -2
  12. package/dist/decorators/memo.decorator.js +2 -2
  13. package/dist/decorators/memoFn.js +1 -2
  14. package/dist/decorators/memoFnAsync.js +1 -2
  15. package/dist/decorators/retry.decorator.js +1 -2
  16. package/dist/decorators/timeout.decorator.js +1 -2
  17. package/dist/define.js +6 -7
  18. package/dist/enum.util.js +20 -21
  19. package/dist/env/buildInfo.js +1 -2
  20. package/dist/env.js +2 -3
  21. package/dist/error/assert.js +9 -10
  22. package/dist/error/error.util.js +11 -11
  23. package/dist/error/try.js +6 -7
  24. package/dist/error/tryCatch.js +2 -2
  25. package/dist/form.util.js +2 -3
  26. package/dist/http/fetcher.d.ts +0 -3
  27. package/dist/http/fetcher.js +2 -2
  28. package/dist/http/fetcher.model.d.ts +0 -2
  29. package/dist/is.util.js +7 -7
  30. package/dist/json-schema/from-data/generateJsonSchemaFromData.js +1 -2
  31. package/dist/json-schema/jsonSchema.util.js +1 -2
  32. package/dist/json-schema/jsonSchemaBuilder.d.ts +8 -9
  33. package/dist/log/commonLogger.js +5 -5
  34. package/dist/math/math.util.js +6 -7
  35. package/dist/number/createDeterministicRandom.js +1 -2
  36. package/dist/number/number.util.js +9 -10
  37. package/dist/object/deepEquals.js +3 -4
  38. package/dist/object/object.util.js +26 -27
  39. package/dist/object/sortObject.js +1 -2
  40. package/dist/object/sortObjectDeep.js +1 -2
  41. package/dist/polyfill.js +1 -2
  42. package/dist/promise/abortable.js +2 -2
  43. package/dist/promise/pDefer.js +1 -2
  44. package/dist/promise/pDelay.js +2 -3
  45. package/dist/promise/pFilter.js +1 -2
  46. package/dist/promise/pHang.js +1 -2
  47. package/dist/promise/pMap.js +1 -2
  48. package/dist/promise/pProps.js +1 -2
  49. package/dist/promise/pRetry.js +2 -3
  50. package/dist/promise/pState.js +1 -2
  51. package/dist/promise/pTimeout.js +2 -3
  52. package/dist/semver.js +2 -2
  53. package/dist/string/case.js +3 -4
  54. package/dist/string/escape.js +2 -3
  55. package/dist/string/hash.util.js +4 -5
  56. package/dist/string/json.util.js +3 -4
  57. package/dist/string/leven.js +1 -2
  58. package/dist/string/lodash/unicodeWords.js +1 -2
  59. package/dist/string/lodash/words.js +1 -2
  60. package/dist/string/pupa.js +2 -2
  61. package/dist/string/readingTime.js +1 -2
  62. package/dist/string/safeJsonStringify.js +1 -2
  63. package/dist/string/string.util.js +13 -14
  64. package/dist/string/stringify.js +2 -3
  65. package/dist/string/url.util.js +1 -2
  66. package/dist/time/time.util.js +3 -4
  67. package/dist/types.d.ts +0 -1
  68. package/dist/types.js +2 -2
  69. package/dist/unit/size.util.js +5 -6
  70. package/dist/web.d.ts +0 -2
  71. package/dist/zod/zod.util.js +4 -4
  72. package/package.json +1 -1
  73. package/src/enum.util.ts +1 -1
  74. package/src/json-schema/from-data/generateJsonSchemaFromData.ts +1 -1
package/dist/abort.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAbortableSignal = void 0;
3
+ exports.createAbortableSignal = createAbortableSignal;
4
4
  /**
5
5
  * Creates AbortableSignal,
6
6
  * which is like AbortSignal, but can "abort itself" with `.abort()` method.
@@ -13,4 +13,3 @@ function createAbortableSignal() {
13
13
  abort: ac.abort.bind(ac),
14
14
  });
15
15
  }
16
- exports.createAbortableSignal = createAbortableSignal;
@@ -1,6 +1,44 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._zip = exports._minByOrUndefined = exports._maxByOrUndefined = exports._minBy = exports._maxBy = exports._max = exports._maxOrUndefined = exports._min = exports._minOrUndefined = exports._first = exports._lastOrUndefined = exports._last = exports._shuffle = exports._mapToObject = exports._sumBy = exports._sum = exports._difference = exports._intersectsWith = exports._intersection = exports._countBy = exports._count = exports._countLessThan = exports._countAtLeast = exports._dropRightWhile = exports._dropWhile = exports._takeRightWhile = exports._takeWhile = exports._findLast = exports._find = exports._sortDescBy = exports._sortBy = exports._groupBy = exports._mapBy = exports._by = exports._uniqBy = exports._pushUniqBy = exports._pushUniq = exports._uniq = exports._chunk = void 0;
3
+ exports._chunk = _chunk;
4
+ exports._uniq = _uniq;
5
+ exports._pushUniq = _pushUniq;
6
+ exports._pushUniqBy = _pushUniqBy;
7
+ exports._uniqBy = _uniqBy;
8
+ exports._by = _by;
9
+ exports._mapBy = _mapBy;
10
+ exports._groupBy = _groupBy;
11
+ exports._sortBy = _sortBy;
12
+ exports._sortDescBy = _sortDescBy;
13
+ exports._find = _find;
14
+ exports._findLast = _findLast;
15
+ exports._takeWhile = _takeWhile;
16
+ exports._takeRightWhile = _takeRightWhile;
17
+ exports._dropWhile = _dropWhile;
18
+ exports._dropRightWhile = _dropRightWhile;
19
+ exports._countAtLeast = _countAtLeast;
20
+ exports._countLessThan = _countLessThan;
21
+ exports._count = _count;
22
+ exports._countBy = _countBy;
23
+ exports._intersection = _intersection;
24
+ exports._intersectsWith = _intersectsWith;
25
+ exports._difference = _difference;
26
+ exports._sum = _sum;
27
+ exports._sumBy = _sumBy;
28
+ exports._mapToObject = _mapToObject;
29
+ exports._shuffle = _shuffle;
30
+ exports._last = _last;
31
+ exports._lastOrUndefined = _lastOrUndefined;
32
+ exports._first = _first;
33
+ exports._minOrUndefined = _minOrUndefined;
34
+ exports._min = _min;
35
+ exports._maxOrUndefined = _maxOrUndefined;
36
+ exports._max = _max;
37
+ exports._maxBy = _maxBy;
38
+ exports._minBy = _minBy;
39
+ exports._maxByOrUndefined = _maxByOrUndefined;
40
+ exports._minByOrUndefined = _minByOrUndefined;
41
+ exports._zip = _zip;
4
42
  const is_util_1 = require("../is.util");
5
43
  const types_1 = require("../types");
6
44
  /**
@@ -20,14 +58,12 @@ function _chunk(array, size = 1) {
20
58
  return idx % size === 0 ? [...arr, [item]] : [...arr.slice(0, -1), [...arr.slice(-1)[0], item]];
21
59
  }, []);
22
60
  }
23
- exports._chunk = _chunk;
24
61
  /**
25
62
  * Removes duplicates from given array.
26
63
  */
27
64
  function _uniq(a) {
28
65
  return [...new Set(a)];
29
66
  }
30
- exports._uniq = _uniq;
31
67
  /**
32
68
  * Pushes an item to an array if it's not already there.
33
69
  * Mutates the array (same as normal `push`) and also returns it for chaining convenience.
@@ -48,7 +84,6 @@ function _pushUniq(a, ...items) {
48
84
  }
49
85
  return a;
50
86
  }
51
- exports._pushUniq = _pushUniq;
52
87
  /**
53
88
  * Like _pushUniq but uses a mapper to determine uniqueness (like _uniqBy).
54
89
  * Mutates the array (same as normal `push`).
@@ -64,7 +99,6 @@ function _pushUniqBy(a, mapper, ...items) {
64
99
  });
65
100
  return a;
66
101
  }
67
- exports._pushUniqBy = _pushUniqBy;
68
102
  /**
69
103
  * This method is like `_.uniq` except that it accepts `iteratee` which is
70
104
  * invoked for each element in `array` to generate the criterion by which
@@ -94,7 +128,6 @@ function _uniqBy(arr, mapper) {
94
128
  .values(),
95
129
  ];
96
130
  }
97
- exports._uniqBy = _uniqBy;
98
131
  /**
99
132
  * const a = [
100
133
  * {id: 'id1', a: 'a1'},
@@ -118,14 +151,12 @@ exports._uniqBy = _uniqBy;
118
151
  function _by(items, mapper) {
119
152
  return Object.fromEntries(items.map((item, i) => [mapper(item, i), item]).filter(([k]) => k !== undefined));
120
153
  }
121
- exports._by = _by;
122
154
  /**
123
155
  * Map an array of items by a key, that is calculated by a Mapper.
124
156
  */
125
157
  function _mapBy(items, mapper) {
126
158
  return new Map(items.map((item, i) => [mapper(item, i), item]).filter(([k]) => k !== undefined));
127
159
  }
128
- exports._mapBy = _mapBy;
129
160
  /**
130
161
  * const a = [1, 2, 3, 4, 5]
131
162
  *
@@ -146,7 +177,6 @@ function _groupBy(items, mapper) {
146
177
  return map;
147
178
  }, {});
148
179
  }
149
- exports._groupBy = _groupBy;
150
180
  /**
151
181
  * _sortBy([{age: 20}, {age: 10}], 'age')
152
182
  * // => [{age: 10}, {age: 20}]
@@ -163,14 +193,12 @@ function _sortBy(items, mapper, mutate = false, dir = 'asc') {
163
193
  return String(a).localeCompare(String(b)) * mod;
164
194
  });
165
195
  }
166
- exports._sortBy = _sortBy;
167
196
  /**
168
197
  * Alias for _sortBy with descending order.
169
198
  */
170
199
  function _sortDescBy(items, mapper, mutate = false) {
171
200
  return _sortBy(items, mapper, mutate, 'desc');
172
201
  }
173
- exports._sortDescBy = _sortDescBy;
174
202
  /**
175
203
  * Similar to `Array.find`, but the `predicate` may return `END` to stop the iteration early.
176
204
  *
@@ -185,7 +213,6 @@ function _find(items, predicate) {
185
213
  return item;
186
214
  }
187
215
  }
188
- exports._find = _find;
189
216
  /**
190
217
  * Similar to `Array.findLast`, but the `predicate` may return `END` to stop the iteration early.
191
218
  *
@@ -196,22 +223,18 @@ exports._find = _find;
196
223
  function _findLast(items, predicate) {
197
224
  return _find(items.slice().reverse(), predicate);
198
225
  }
199
- exports._findLast = _findLast;
200
226
  function _takeWhile(items, predicate) {
201
227
  let proceed = true;
202
228
  return items.filter((v, index) => (proceed &&= predicate(v, index)));
203
229
  }
204
- exports._takeWhile = _takeWhile;
205
230
  function _takeRightWhile(items, predicate) {
206
231
  let proceed = true;
207
232
  return [...items].reverse().filter((v, index) => (proceed &&= predicate(v, index)));
208
233
  }
209
- exports._takeRightWhile = _takeRightWhile;
210
234
  function _dropWhile(items, predicate) {
211
235
  let proceed = false;
212
236
  return items.filter((v, index) => (proceed ||= !predicate(v, index)));
213
237
  }
214
- exports._dropWhile = _dropWhile;
215
238
  function _dropRightWhile(items, predicate) {
216
239
  let proceed = false;
217
240
  return [...items]
@@ -219,7 +242,6 @@ function _dropRightWhile(items, predicate) {
219
242
  .filter((v, index) => (proceed ||= !predicate(v, index)))
220
243
  .reverse();
221
244
  }
222
- exports._dropRightWhile = _dropRightWhile;
223
245
  /**
224
246
  * Returns true if the _count >= limit.
225
247
  * _count counts how many times the Predicate returns true, and stops
@@ -228,7 +250,6 @@ exports._dropRightWhile = _dropRightWhile;
228
250
  function _countAtLeast(items, predicate, limit) {
229
251
  return _count(items, predicate, limit) >= limit;
230
252
  }
231
- exports._countAtLeast = _countAtLeast;
232
253
  /**
233
254
  * Returns true if the _count <> limit.
234
255
  * _count counts how many times the Predicate returns true, and stops
@@ -237,7 +258,6 @@ exports._countAtLeast = _countAtLeast;
237
258
  function _countLessThan(items, predicate, limit) {
238
259
  return _count(items, predicate, limit) < limit;
239
260
  }
240
- exports._countLessThan = _countLessThan;
241
261
  /**
242
262
  * Counts how many items match the predicate.
243
263
  *
@@ -260,7 +280,6 @@ function _count(items, predicate, limit) {
260
280
  }
261
281
  return count;
262
282
  }
263
- exports._count = _count;
264
283
  function _countBy(items, mapper) {
265
284
  const map = {};
266
285
  let i = 0;
@@ -270,7 +289,6 @@ function _countBy(items, mapper) {
270
289
  }
271
290
  return map;
272
291
  }
273
- exports._countBy = _countBy;
274
292
  // investigate: _groupBy
275
293
  /**
276
294
  * Returns an intersection between 2 arrays.
@@ -287,7 +305,6 @@ function _intersection(a1, a2) {
287
305
  const a2set = a2 instanceof Set ? a2 : new Set(a2);
288
306
  return a1.filter(v => a2set.has(v));
289
307
  }
290
- exports._intersection = _intersection;
291
308
  /**
292
309
  * Returns true if there is at least 1 item common between 2 arrays.
293
310
  * Otherwise returns false.
@@ -300,7 +317,6 @@ function _intersectsWith(a1, a2) {
300
317
  const a2set = a2 instanceof Set ? a2 : new Set(a2);
301
318
  return a1.some(v => a2set.has(v));
302
319
  }
303
- exports._intersectsWith = _intersectsWith;
304
320
  /**
305
321
  * @example
306
322
  * _difference([2, 1], [2, 3])
@@ -309,7 +325,6 @@ exports._intersectsWith = _intersectsWith;
309
325
  function _difference(source, ...diffs) {
310
326
  return diffs.reduce((a, b) => a.filter(c => !b.includes(c)), source);
311
327
  }
312
- exports._difference = _difference;
313
328
  /**
314
329
  * Returns the sum of items, or 0 for empty array.
315
330
  */
@@ -320,7 +335,6 @@ function _sum(items) {
320
335
  }
321
336
  return sum;
322
337
  }
323
- exports._sum = _sum;
324
338
  function _sumBy(items, mapper) {
325
339
  let sum = 0;
326
340
  let i = 0;
@@ -333,7 +347,6 @@ function _sumBy(items, mapper) {
333
347
  }
334
348
  return sum;
335
349
  }
336
- exports._sumBy = _sumBy;
337
350
  /**
338
351
  * Map an array of T to a StringMap<V>,
339
352
  * by returning a tuple of [key, value] from a mapper function.
@@ -357,7 +370,6 @@ function _mapToObject(array, mapper) {
357
370
  }
358
371
  return m;
359
372
  }
360
- exports._mapToObject = _mapToObject;
361
373
  /**
362
374
  * Randomly shuffle an array values.
363
375
  * Fisher–Yates algorithm.
@@ -371,7 +383,6 @@ function _shuffle(array, mutate = false) {
371
383
  }
372
384
  return a;
373
385
  }
374
- exports._shuffle = _shuffle;
375
386
  /**
376
387
  * Returns last item of non-empty array.
377
388
  * Throws if array is empty.
@@ -381,14 +392,12 @@ function _last(array) {
381
392
  throw new Error('_last called on empty array');
382
393
  return array[array.length - 1];
383
394
  }
384
- exports._last = _last;
385
395
  /**
386
396
  * Returns last item of the array (or undefined if array is empty).
387
397
  */
388
398
  function _lastOrUndefined(array) {
389
399
  return array[array.length - 1];
390
400
  }
391
- exports._lastOrUndefined = _lastOrUndefined;
392
401
  /**
393
402
  * Returns the first item of non-empty array.
394
403
  * Throws if array is empty.
@@ -398,14 +407,12 @@ function _first(array) {
398
407
  throw new Error('_first called on empty array');
399
408
  return array[0];
400
409
  }
401
- exports._first = _first;
402
410
  function _minOrUndefined(array) {
403
411
  const a = array.filter(is_util_1._isNotNullish);
404
412
  if (!a.length)
405
413
  return;
406
414
  return a.reduce((min, item) => (min <= item ? min : item));
407
415
  }
408
- exports._minOrUndefined = _minOrUndefined;
409
416
  /**
410
417
  * Filters out nullish values (undefined and null).
411
418
  */
@@ -415,14 +422,12 @@ function _min(array) {
415
422
  throw new Error('_min called on empty array');
416
423
  return a.reduce((min, item) => (min <= item ? min : item));
417
424
  }
418
- exports._min = _min;
419
425
  function _maxOrUndefined(array) {
420
426
  const a = array.filter(is_util_1._isNotNullish);
421
427
  if (!a.length)
422
428
  return;
423
429
  return a.reduce((max, item) => (max >= item ? max : item));
424
430
  }
425
- exports._maxOrUndefined = _maxOrUndefined;
426
431
  /**
427
432
  * Filters out nullish values (undefined and null).
428
433
  */
@@ -432,21 +437,18 @@ function _max(array) {
432
437
  throw new Error('_max called on empty array');
433
438
  return a.reduce((max, item) => (max >= item ? max : item));
434
439
  }
435
- exports._max = _max;
436
440
  function _maxBy(array, mapper) {
437
441
  const max = _maxByOrUndefined(array, mapper);
438
442
  if (max === undefined)
439
443
  throw new Error(`_maxBy returned undefined`);
440
444
  return max;
441
445
  }
442
- exports._maxBy = _maxBy;
443
446
  function _minBy(array, mapper) {
444
447
  const min = _minByOrUndefined(array, mapper);
445
448
  if (min === undefined)
446
449
  throw new Error(`_minBy returned undefined`);
447
450
  return min;
448
451
  }
449
- exports._minBy = _minBy;
450
452
  // todo: looks like it _maxByOrUndefined/_minByOrUndefined can be DRYer
451
453
  function _maxByOrUndefined(array, mapper) {
452
454
  if (!array.length)
@@ -462,7 +464,6 @@ function _maxByOrUndefined(array, mapper) {
462
464
  }
463
465
  return maxItem;
464
466
  }
465
- exports._maxByOrUndefined = _maxByOrUndefined;
466
467
  function _minByOrUndefined(array, mapper) {
467
468
  if (!array.length)
468
469
  return;
@@ -477,7 +478,6 @@ function _minByOrUndefined(array, mapper) {
477
478
  }
478
479
  return minItem;
479
480
  }
480
- exports._minByOrUndefined = _minByOrUndefined;
481
481
  function _zip(array1, array2) {
482
482
  const len = Math.min(array1.length, array2.length);
483
483
  const res = [];
@@ -486,4 +486,3 @@ function _zip(array1, array2) {
486
486
  }
487
487
  return res;
488
488
  }
489
- exports._zip = _zip;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._rangeAsyncIterable = exports._rangeIterable = exports._range = void 0;
3
+ exports._range = _range;
4
+ exports._rangeIterable = _rangeIterable;
5
+ exports._rangeAsyncIterable = _rangeAsyncIterable;
4
6
  const asyncIterable2_1 = require("../iter/asyncIterable2");
5
7
  const iterable2_1 = require("../iter/iterable2");
6
8
  function _range(fromIncl, toExcl, step = 1) {
@@ -9,7 +11,6 @@ function _range(fromIncl, toExcl, step = 1) {
9
11
  }
10
12
  return Array.from({ length: Math.ceil((toExcl - fromIncl) / step) }, (_, i) => i * step + fromIncl);
11
13
  }
12
- exports._range = _range;
13
14
  function _rangeIterable(fromIncl, toExcl, step = 1) {
14
15
  if (toExcl === undefined) {
15
16
  toExcl = fromIncl;
@@ -23,7 +24,6 @@ function _rangeIterable(fromIncl, toExcl, step = 1) {
23
24
  },
24
25
  });
25
26
  }
26
- exports._rangeIterable = _rangeIterable;
27
27
  function _rangeAsyncIterable(fromIncl, toExcl, step = 1) {
28
28
  if (toExcl === undefined) {
29
29
  toExcl = fromIncl;
@@ -37,4 +37,3 @@ function _rangeAsyncIterable(fromIncl, toExcl, step = 1) {
37
37
  },
38
38
  });
39
39
  }
40
- exports._rangeAsyncIterable = _rangeAsyncIterable;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.todayString = exports.localDate = exports.LocalDate = void 0;
3
+ exports.localDate = exports.LocalDate = void 0;
4
+ exports.todayString = todayString;
4
5
  const assert_1 = require("../error/assert");
5
6
  const is_util_1 = require("../is.util");
6
7
  const iterable2_1 = require("../iter/iterable2");
@@ -626,4 +627,3 @@ Object.setPrototypeOf(exports.localDate, localDateFactory);
626
627
  function todayString() {
627
628
  return exports.localDate.fromDate(new Date()).toISODate();
628
629
  }
629
- exports.todayString = todayString;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.nowUnix = exports.localTime = exports.LocalTime = exports.ISODayOfWeek = void 0;
3
+ exports.localTime = exports.LocalTime = exports.ISODayOfWeek = void 0;
4
+ exports.nowUnix = nowUnix;
4
5
  const assert_1 = require("../error/assert");
5
6
  const is_util_1 = require("../is.util");
6
7
  const time_util_1 = require("../time/time.util");
@@ -823,4 +824,3 @@ Object.setPrototypeOf(exports.localTime, localTimeFactory);
823
824
  function nowUnix() {
824
825
  return Math.floor(Date.now() / 1000);
825
826
  }
826
- exports.nowUnix = nowUnix;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._getAsyncMemo = exports._AsyncMemo = void 0;
3
+ exports._AsyncMemo = void 0;
4
+ exports._getAsyncMemo = _getAsyncMemo;
4
5
  const assert_1 = require("../error/assert");
5
6
  const types_1 = require("../types");
6
7
  const decorator_util_1 = require("./decorator.util");
@@ -115,4 +116,3 @@ function _getAsyncMemo(method) {
115
116
  (0, assert_1._assert)(typeof method?.getInstanceCache === 'function', 'method is not an AsyncMemo instance');
116
117
  return method;
117
118
  }
118
- exports._getAsyncMemo = _getAsyncMemo;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._createPromiseDecorator = void 0;
3
+ exports._createPromiseDecorator = _createPromiseDecorator;
4
4
  const decorator_util_1 = require("./decorator.util");
5
5
  /**
6
6
  * @example
@@ -83,4 +83,3 @@ function _createPromiseDecorator(cfg, decoratorParams = {}) {
83
83
  return pd;
84
84
  };
85
85
  }
86
- exports._createPromiseDecorator = _createPromiseDecorator;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._Throttle = exports._Debounce = void 0;
3
+ exports._Debounce = _Debounce;
4
+ exports._Throttle = _Throttle;
4
5
  const debounce_1 = require("./debounce");
5
6
  // eslint-disable-next-line @typescript-eslint/naming-convention
6
7
  function _Debounce(wait, opt = {}) {
@@ -10,7 +11,6 @@ function _Debounce(wait, opt = {}) {
10
11
  return descriptor;
11
12
  };
12
13
  }
13
- exports._Debounce = _Debounce;
14
14
  // eslint-disable-next-line @typescript-eslint/naming-convention
15
15
  function _Throttle(wait, opt = {}) {
16
16
  return (target, key, descriptor) => {
@@ -19,4 +19,3 @@ function _Throttle(wait, opt = {}) {
19
19
  return descriptor;
20
20
  };
21
21
  }
22
- exports._Throttle = _Throttle;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._throttle = exports._debounce = void 0;
3
+ exports._debounce = _debounce;
4
+ exports._throttle = _throttle;
4
5
  function _debounce(func, wait, opt = {}) {
5
6
  let lastArgs;
6
7
  let lastThis;
@@ -107,7 +108,6 @@ function _debounce(func, wait, opt = {}) {
107
108
  debounced.pending = pending;
108
109
  return debounced;
109
110
  }
110
- exports._debounce = _debounce;
111
111
  function _throttle(func, wait, opt = {}) {
112
112
  return _debounce(func, wait, {
113
113
  leading: true,
@@ -116,4 +116,3 @@ function _throttle(func, wait, opt = {}) {
116
116
  maxWait: wait,
117
117
  });
118
118
  }
119
- exports._throttle = _throttle;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._getArgsSignature = exports._getTargetMethodSignature = exports._getMethodSignature = void 0;
3
+ exports._getMethodSignature = _getMethodSignature;
4
+ exports._getTargetMethodSignature = _getTargetMethodSignature;
5
+ exports._getArgsSignature = _getArgsSignature;
4
6
  /**
5
7
  * @returns
6
8
  * e.g `NameOfYourClass.methodName`
@@ -10,14 +12,12 @@ function _getMethodSignature(ctx, keyStr) {
10
12
  const { instanceId } = ctx;
11
13
  return `${ctx.constructor.name}${instanceId ? `#${instanceId}` : ''}.${keyStr}`;
12
14
  }
13
- exports._getMethodSignature = _getMethodSignature;
14
15
  /**
15
16
  * @returns `NameOfYourClass.methodName`
16
17
  */
17
18
  function _getTargetMethodSignature(target, keyStr) {
18
19
  return `${target.constructor.name}.${keyStr}`;
19
20
  }
20
- exports._getTargetMethodSignature = _getTargetMethodSignature;
21
21
  /**
22
22
  * @example
23
23
  * e.g for method (a: string, b: string, c: string)
@@ -34,4 +34,3 @@ function _getArgsSignature(args = [], logArgs = true) {
34
34
  })
35
35
  .join(', ');
36
36
  }
37
- exports._getArgsSignature = _getArgsSignature;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._LogMethod = void 0;
3
+ exports._LogMethod = _LogMethod;
4
4
  const __1 = require("..");
5
5
  const time_util_1 = require("../time/time.util");
6
6
  const decorator_util_1 = require("./decorator.util");
@@ -71,7 +71,6 @@ function _LogMethod(opt = {}) {
71
71
  return descriptor;
72
72
  };
73
73
  }
74
- exports._LogMethod = _LogMethod;
75
74
  // eslint-disable-next-line max-params
76
75
  function logFinished(logger, callSignature, started, sma, logResultFn, res, err) {
77
76
  const millis = Date.now() - started;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._getMemo = exports._Memo = void 0;
3
+ exports._Memo = void 0;
4
+ exports._getMemo = _getMemo;
4
5
  const assert_1 = require("../error/assert");
5
6
  const types_1 = require("../types");
6
7
  const decorator_util_1 = require("./decorator.util");
@@ -84,4 +85,3 @@ function _getMemo(method) {
84
85
  (0, assert_1._assert)(typeof method?.getInstanceCache === 'function', 'method is not a Memo instance');
85
86
  return method;
86
87
  }
87
- exports._getMemo = _getMemo;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._memoFn = void 0;
3
+ exports._memoFn = _memoFn;
4
4
  const memo_util_1 = require("./memo.util");
5
5
  /**
6
6
  * Only supports Sync functions.
@@ -30,4 +30,3 @@ function _memoFn(fn, opt = {}) {
30
30
  Object.assign(memoizedFn, { cache });
31
31
  return memoizedFn;
32
32
  }
33
- exports._memoFn = _memoFn;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._memoFnAsync = void 0;
3
+ exports._memoFnAsync = _memoFnAsync;
4
4
  const types_1 = require("../types");
5
5
  const memo_util_1 = require("./memo.util");
6
6
  /**
@@ -36,4 +36,3 @@ function _memoFnAsync(fn, opt) {
36
36
  Object.assign(memoizedFn, { cache });
37
37
  return memoizedFn;
38
38
  }
39
- exports._memoFnAsync = _memoFnAsync;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._Retry = void 0;
3
+ exports._Retry = _Retry;
4
4
  const __1 = require("..");
5
5
  // eslint-disable-next-line @typescript-eslint/naming-convention
6
6
  function _Retry(opt = {}) {
@@ -10,4 +10,3 @@ function _Retry(opt = {}) {
10
10
  return descriptor;
11
11
  };
12
12
  }
13
- exports._Retry = _Retry;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._Timeout = void 0;
3
+ exports._Timeout = _Timeout;
4
4
  const assert_1 = require("../error/assert");
5
5
  const pTimeout_1 = require("../promise/pTimeout");
6
6
  const decorator_util_1 = require("./decorator.util");
@@ -20,4 +20,3 @@ function _Timeout(opt) {
20
20
  return descriptor;
21
21
  };
22
22
  }
23
- exports._Timeout = _Timeout;
package/dist/define.js CHANGED
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._defineNonNullishProps = exports._defineProps = exports._defineProperty = exports._defineLazyProps = exports._defineLazyProperty = exports._lazyValue = void 0;
3
+ exports._lazyValue = _lazyValue;
4
+ exports._defineLazyProperty = _defineLazyProperty;
5
+ exports._defineLazyProps = _defineLazyProps;
6
+ exports._defineProperty = _defineProperty;
7
+ exports._defineProps = _defineProps;
8
+ exports._defineNonNullishProps = _defineNonNullishProps;
4
9
  const object_util_1 = require("./object/object.util");
5
10
  const types_1 = require("./types");
6
11
  /**
@@ -23,7 +28,6 @@ function _lazyValue(fn) {
23
28
  return result;
24
29
  });
25
30
  }
26
- exports._lazyValue = _lazyValue;
27
31
  /**
28
32
  * interface Obj {
29
33
  * v: number
@@ -56,7 +60,6 @@ function _defineLazyProperty(obj, propertyName, fn) {
56
60
  });
57
61
  return obj;
58
62
  }
59
- exports._defineLazyProperty = _defineLazyProperty;
60
63
  /**
61
64
  * Like _defineLazyProperty, but allows to define multiple props at once.
62
65
  */
@@ -64,7 +67,6 @@ function _defineLazyProps(obj, props) {
64
67
  Object.entries(props).forEach(([k, fn]) => _defineLazyProperty(obj, k, fn));
65
68
  return obj;
66
69
  }
67
- exports._defineLazyProps = _defineLazyProps;
68
70
  /**
69
71
  * Same as Object.defineProperty, but with better (least restricting) defaults.
70
72
  *
@@ -90,7 +92,6 @@ function _defineProperty(obj, prop, pd) {
90
92
  ...pd,
91
93
  });
92
94
  }
93
- exports._defineProperty = _defineProperty;
94
95
  /**
95
96
  * Object.defineProperties with better defaults.
96
97
  * See _defineProperty for exact defaults definition.
@@ -104,7 +105,6 @@ function _defineProps(obj, props) {
104
105
  ...pd,
105
106
  })));
106
107
  }
107
- exports._defineProps = _defineProps;
108
108
  /**
109
109
  * Like _defineProps, but skips props with nullish values.
110
110
  */
@@ -115,4 +115,3 @@ function _defineNonNullishProps(obj, props) {
115
115
  return [k, pd];
116
116
  }));
117
117
  }
118
- exports._defineNonNullishProps = _defineNonNullishProps;