@tally.paws/toolbox 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/dist/index.d.mts CHANGED
@@ -233,32 +233,32 @@ type DurationBuilderShortBase = {
233
233
  toH(): number;
234
234
  toD(): number;
235
235
  };
236
- type LongValues = {
236
+ type LongValues$1 = {
237
237
  milliseconds(v: number): DurationBuilderLong;
238
238
  seconds(v: number): DurationBuilderLong;
239
239
  minutes(v: number): DurationBuilderLong;
240
240
  hours(v: number): DurationBuilderLong;
241
241
  days(v: number): DurationBuilderLong;
242
242
  };
243
- type DurationBuilderLong = Flat<DurationBuilderLongBase & LongValues>;
244
- type ShortValues = {
243
+ type DurationBuilderLong = Flat<DurationBuilderLongBase & LongValues$1>;
244
+ type ShortValues$1 = {
245
245
  ms(v: number): DurationBuilderShort;
246
246
  s(v: number): DurationBuilderShort;
247
247
  m(v: number): DurationBuilderShort;
248
248
  h(v: number): DurationBuilderShort;
249
249
  d(v: number): DurationBuilderShort;
250
250
  };
251
- type DurationBuilderShort = Flat<DurationBuilderShortBase & ShortValues>;
252
- declare const days: (v: number) => Flat<DurationBuilderLongBase & LongValues>;
253
- declare const hours: (v: number) => Flat<DurationBuilderLongBase & LongValues>;
254
- declare const minutes: (v: number) => Flat<DurationBuilderLongBase & LongValues>;
255
- declare const seconds: (v: number) => Flat<DurationBuilderLongBase & LongValues>;
256
- declare const milliseconds: (v: number) => Flat<DurationBuilderLongBase & LongValues>;
257
- declare const d: (v: number) => Flat<DurationBuilderShortBase & ShortValues>;
258
- declare const h: (v: number) => Flat<DurationBuilderShortBase & ShortValues>;
259
- declare const m: (v: number) => Flat<DurationBuilderShortBase & ShortValues>;
260
- declare const s: (v: number) => Flat<DurationBuilderShortBase & ShortValues>;
261
- declare const ms: (v: number) => Flat<DurationBuilderShortBase & ShortValues>;
251
+ type DurationBuilderShort = Flat<DurationBuilderShortBase & ShortValues$1>;
252
+ declare const days: (v: number) => Flat<DurationBuilderLongBase & LongValues$1>;
253
+ declare const hours: (v: number) => Flat<DurationBuilderLongBase & LongValues$1>;
254
+ declare const minutes: (v: number) => Flat<DurationBuilderLongBase & LongValues$1>;
255
+ declare const seconds: (v: number) => Flat<DurationBuilderLongBase & LongValues$1>;
256
+ declare const milliseconds: (v: number) => Flat<DurationBuilderLongBase & LongValues$1>;
257
+ declare const d: (v: number) => Flat<DurationBuilderShortBase & ShortValues$1>;
258
+ declare const h: (v: number) => Flat<DurationBuilderShortBase & ShortValues$1>;
259
+ declare const m: (v: number) => Flat<DurationBuilderShortBase & ShortValues$1>;
260
+ declare const s: (v: number) => Flat<DurationBuilderShortBase & ShortValues$1>;
261
+ declare const ms: (v: number) => Flat<DurationBuilderShortBase & ShortValues$1>;
262
262
 
263
263
  /**
264
264
  * BigInt Exponent Operation.
@@ -365,4 +365,105 @@ declare class AccessMap<K, V> {
365
365
  private resetTimer;
366
366
  }
367
367
 
368
- export { AccessMap, AsyncQueue, type DebouncedFunction, type DeepPartial, type DeepRequired, type Entries, type Flat, type Merge, type Mutable, type NonNullable, type Nullable, TimedMap, type TupleOf, type ValueOf, bigIntPower, chance, chunk, clamp, convertBase, cycle, d, days, debounce, deepEqual, deferred, h, hours, inRange, lerp, m, milliseconds, minutes, ms, noop, omit, once, pick, randInt, range, retry, rotate, roundTo, s, sample, seconds, shuffle, sleep, tap, throttle, timeoutPromise, tryCatch };
368
+ type DataSizeBuilderLongBase = {
369
+ toBytes(): number;
370
+ toKilobytes(): number;
371
+ toMegabytes(): number;
372
+ toGigabytes(): number;
373
+ toTerabytes(): number;
374
+ toPetabytes(): number;
375
+ toExabytes(): number;
376
+ toZettabytes(): number;
377
+ toKibibytes(): number;
378
+ toMebibytes(): number;
379
+ toGibibytes(): number;
380
+ toTebibytes(): number;
381
+ toPebibytes(): number;
382
+ toExbibytes(): number;
383
+ toZebibytes(): number;
384
+ };
385
+ type DataSizeBuilderShortBase = {
386
+ toB(): number;
387
+ toKB(): number;
388
+ toMB(): number;
389
+ toGB(): number;
390
+ toTB(): number;
391
+ toPB(): number;
392
+ toEB(): number;
393
+ toZB(): number;
394
+ toKiB(): number;
395
+ toMiB(): number;
396
+ toGiB(): number;
397
+ toTiB(): number;
398
+ toPiB(): number;
399
+ toEiB(): number;
400
+ toZiB(): number;
401
+ };
402
+ type LongValues = {
403
+ bytes(v: number): DataSizeBuilderLong;
404
+ kilobytes(v: number): DataSizeBuilderLong;
405
+ megabytes(v: number): DataSizeBuilderLong;
406
+ gigabytes(v: number): DataSizeBuilderLong;
407
+ terabytes(v: number): DataSizeBuilderLong;
408
+ petabytes(v: number): DataSizeBuilderLong;
409
+ exabytes(v: number): DataSizeBuilderLong;
410
+ zettabytes(v: number): DataSizeBuilderLong;
411
+ kibibytes(v: number): DataSizeBuilderLong;
412
+ mebibytes(v: number): DataSizeBuilderLong;
413
+ gibibytes(v: number): DataSizeBuilderLong;
414
+ tebibytes(v: number): DataSizeBuilderLong;
415
+ pebibytes(v: number): DataSizeBuilderLong;
416
+ exbibytes(v: number): DataSizeBuilderLong;
417
+ zebibytes(v: number): DataSizeBuilderLong;
418
+ };
419
+ type DataSizeBuilderLong = Flat<DataSizeBuilderLongBase & LongValues>;
420
+ type ShortValues = {
421
+ B(v: number): DataSizeBuilderShort;
422
+ kB(v: number): DataSizeBuilderShort;
423
+ MB(v: number): DataSizeBuilderShort;
424
+ GB(v: number): DataSizeBuilderShort;
425
+ TB(v: number): DataSizeBuilderShort;
426
+ PB(v: number): DataSizeBuilderShort;
427
+ EB(v: number): DataSizeBuilderShort;
428
+ ZB(v: number): DataSizeBuilderShort;
429
+ KiB(v: number): DataSizeBuilderShort;
430
+ MiB(v: number): DataSizeBuilderShort;
431
+ GiB(v: number): DataSizeBuilderShort;
432
+ TiB(v: number): DataSizeBuilderShort;
433
+ PiB(v: number): DataSizeBuilderShort;
434
+ EiB(v: number): DataSizeBuilderShort;
435
+ ZiB(v: number): DataSizeBuilderShort;
436
+ };
437
+ type DataSizeBuilderShort = Flat<DataSizeBuilderShortBase & ShortValues>;
438
+ declare const bytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
439
+ declare const kilobytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
440
+ declare const megabytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
441
+ declare const gigabytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
442
+ declare const terabytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
443
+ declare const petabytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
444
+ declare const exabytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
445
+ declare const zettabytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
446
+ declare const kibibytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
447
+ declare const mebibytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
448
+ declare const gibibytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
449
+ declare const tebibytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
450
+ declare const pebibytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
451
+ declare const exbibytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
452
+ declare const zebibytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
453
+ declare const B: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
454
+ declare const kB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
455
+ declare const MB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
456
+ declare const GB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
457
+ declare const TB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
458
+ declare const PB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
459
+ declare const EB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
460
+ declare const ZB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
461
+ declare const KiB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
462
+ declare const MiB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
463
+ declare const GiB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
464
+ declare const TiB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
465
+ declare const PiB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
466
+ declare const EiB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
467
+ declare const ZiB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
468
+
469
+ export { AccessMap, AsyncQueue, B, type DebouncedFunction, type DeepPartial, type DeepRequired, EB, EiB, type Entries, type Flat, GB, GiB, KiB, MB, type Merge, MiB, type Mutable, type NonNullable, type Nullable, PB, PiB, TB, TiB, TimedMap, type TupleOf, type ValueOf, ZB, ZiB, bigIntPower, bytes, chance, chunk, clamp, convertBase, cycle, d, days, debounce, deepEqual, deferred, exabytes, exbibytes, gibibytes, gigabytes, h, hours, inRange, kB, kibibytes, kilobytes, lerp, m, mebibytes, megabytes, milliseconds, minutes, ms, noop, omit, once, pebibytes, petabytes, pick, randInt, range, retry, rotate, roundTo, s, sample, seconds, shuffle, sleep, tap, tebibytes, terabytes, throttle, timeoutPromise, tryCatch, zebibytes, zettabytes };
package/dist/index.d.ts CHANGED
@@ -233,32 +233,32 @@ type DurationBuilderShortBase = {
233
233
  toH(): number;
234
234
  toD(): number;
235
235
  };
236
- type LongValues = {
236
+ type LongValues$1 = {
237
237
  milliseconds(v: number): DurationBuilderLong;
238
238
  seconds(v: number): DurationBuilderLong;
239
239
  minutes(v: number): DurationBuilderLong;
240
240
  hours(v: number): DurationBuilderLong;
241
241
  days(v: number): DurationBuilderLong;
242
242
  };
243
- type DurationBuilderLong = Flat<DurationBuilderLongBase & LongValues>;
244
- type ShortValues = {
243
+ type DurationBuilderLong = Flat<DurationBuilderLongBase & LongValues$1>;
244
+ type ShortValues$1 = {
245
245
  ms(v: number): DurationBuilderShort;
246
246
  s(v: number): DurationBuilderShort;
247
247
  m(v: number): DurationBuilderShort;
248
248
  h(v: number): DurationBuilderShort;
249
249
  d(v: number): DurationBuilderShort;
250
250
  };
251
- type DurationBuilderShort = Flat<DurationBuilderShortBase & ShortValues>;
252
- declare const days: (v: number) => Flat<DurationBuilderLongBase & LongValues>;
253
- declare const hours: (v: number) => Flat<DurationBuilderLongBase & LongValues>;
254
- declare const minutes: (v: number) => Flat<DurationBuilderLongBase & LongValues>;
255
- declare const seconds: (v: number) => Flat<DurationBuilderLongBase & LongValues>;
256
- declare const milliseconds: (v: number) => Flat<DurationBuilderLongBase & LongValues>;
257
- declare const d: (v: number) => Flat<DurationBuilderShortBase & ShortValues>;
258
- declare const h: (v: number) => Flat<DurationBuilderShortBase & ShortValues>;
259
- declare const m: (v: number) => Flat<DurationBuilderShortBase & ShortValues>;
260
- declare const s: (v: number) => Flat<DurationBuilderShortBase & ShortValues>;
261
- declare const ms: (v: number) => Flat<DurationBuilderShortBase & ShortValues>;
251
+ type DurationBuilderShort = Flat<DurationBuilderShortBase & ShortValues$1>;
252
+ declare const days: (v: number) => Flat<DurationBuilderLongBase & LongValues$1>;
253
+ declare const hours: (v: number) => Flat<DurationBuilderLongBase & LongValues$1>;
254
+ declare const minutes: (v: number) => Flat<DurationBuilderLongBase & LongValues$1>;
255
+ declare const seconds: (v: number) => Flat<DurationBuilderLongBase & LongValues$1>;
256
+ declare const milliseconds: (v: number) => Flat<DurationBuilderLongBase & LongValues$1>;
257
+ declare const d: (v: number) => Flat<DurationBuilderShortBase & ShortValues$1>;
258
+ declare const h: (v: number) => Flat<DurationBuilderShortBase & ShortValues$1>;
259
+ declare const m: (v: number) => Flat<DurationBuilderShortBase & ShortValues$1>;
260
+ declare const s: (v: number) => Flat<DurationBuilderShortBase & ShortValues$1>;
261
+ declare const ms: (v: number) => Flat<DurationBuilderShortBase & ShortValues$1>;
262
262
 
263
263
  /**
264
264
  * BigInt Exponent Operation.
@@ -365,4 +365,105 @@ declare class AccessMap<K, V> {
365
365
  private resetTimer;
366
366
  }
367
367
 
368
- export { AccessMap, AsyncQueue, type DebouncedFunction, type DeepPartial, type DeepRequired, type Entries, type Flat, type Merge, type Mutable, type NonNullable, type Nullable, TimedMap, type TupleOf, type ValueOf, bigIntPower, chance, chunk, clamp, convertBase, cycle, d, days, debounce, deepEqual, deferred, h, hours, inRange, lerp, m, milliseconds, minutes, ms, noop, omit, once, pick, randInt, range, retry, rotate, roundTo, s, sample, seconds, shuffle, sleep, tap, throttle, timeoutPromise, tryCatch };
368
+ type DataSizeBuilderLongBase = {
369
+ toBytes(): number;
370
+ toKilobytes(): number;
371
+ toMegabytes(): number;
372
+ toGigabytes(): number;
373
+ toTerabytes(): number;
374
+ toPetabytes(): number;
375
+ toExabytes(): number;
376
+ toZettabytes(): number;
377
+ toKibibytes(): number;
378
+ toMebibytes(): number;
379
+ toGibibytes(): number;
380
+ toTebibytes(): number;
381
+ toPebibytes(): number;
382
+ toExbibytes(): number;
383
+ toZebibytes(): number;
384
+ };
385
+ type DataSizeBuilderShortBase = {
386
+ toB(): number;
387
+ toKB(): number;
388
+ toMB(): number;
389
+ toGB(): number;
390
+ toTB(): number;
391
+ toPB(): number;
392
+ toEB(): number;
393
+ toZB(): number;
394
+ toKiB(): number;
395
+ toMiB(): number;
396
+ toGiB(): number;
397
+ toTiB(): number;
398
+ toPiB(): number;
399
+ toEiB(): number;
400
+ toZiB(): number;
401
+ };
402
+ type LongValues = {
403
+ bytes(v: number): DataSizeBuilderLong;
404
+ kilobytes(v: number): DataSizeBuilderLong;
405
+ megabytes(v: number): DataSizeBuilderLong;
406
+ gigabytes(v: number): DataSizeBuilderLong;
407
+ terabytes(v: number): DataSizeBuilderLong;
408
+ petabytes(v: number): DataSizeBuilderLong;
409
+ exabytes(v: number): DataSizeBuilderLong;
410
+ zettabytes(v: number): DataSizeBuilderLong;
411
+ kibibytes(v: number): DataSizeBuilderLong;
412
+ mebibytes(v: number): DataSizeBuilderLong;
413
+ gibibytes(v: number): DataSizeBuilderLong;
414
+ tebibytes(v: number): DataSizeBuilderLong;
415
+ pebibytes(v: number): DataSizeBuilderLong;
416
+ exbibytes(v: number): DataSizeBuilderLong;
417
+ zebibytes(v: number): DataSizeBuilderLong;
418
+ };
419
+ type DataSizeBuilderLong = Flat<DataSizeBuilderLongBase & LongValues>;
420
+ type ShortValues = {
421
+ B(v: number): DataSizeBuilderShort;
422
+ kB(v: number): DataSizeBuilderShort;
423
+ MB(v: number): DataSizeBuilderShort;
424
+ GB(v: number): DataSizeBuilderShort;
425
+ TB(v: number): DataSizeBuilderShort;
426
+ PB(v: number): DataSizeBuilderShort;
427
+ EB(v: number): DataSizeBuilderShort;
428
+ ZB(v: number): DataSizeBuilderShort;
429
+ KiB(v: number): DataSizeBuilderShort;
430
+ MiB(v: number): DataSizeBuilderShort;
431
+ GiB(v: number): DataSizeBuilderShort;
432
+ TiB(v: number): DataSizeBuilderShort;
433
+ PiB(v: number): DataSizeBuilderShort;
434
+ EiB(v: number): DataSizeBuilderShort;
435
+ ZiB(v: number): DataSizeBuilderShort;
436
+ };
437
+ type DataSizeBuilderShort = Flat<DataSizeBuilderShortBase & ShortValues>;
438
+ declare const bytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
439
+ declare const kilobytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
440
+ declare const megabytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
441
+ declare const gigabytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
442
+ declare const terabytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
443
+ declare const petabytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
444
+ declare const exabytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
445
+ declare const zettabytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
446
+ declare const kibibytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
447
+ declare const mebibytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
448
+ declare const gibibytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
449
+ declare const tebibytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
450
+ declare const pebibytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
451
+ declare const exbibytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
452
+ declare const zebibytes: (v: number) => Flat<DataSizeBuilderLongBase & LongValues>;
453
+ declare const B: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
454
+ declare const kB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
455
+ declare const MB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
456
+ declare const GB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
457
+ declare const TB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
458
+ declare const PB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
459
+ declare const EB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
460
+ declare const ZB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
461
+ declare const KiB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
462
+ declare const MiB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
463
+ declare const GiB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
464
+ declare const TiB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
465
+ declare const PiB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
466
+ declare const EiB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
467
+ declare const ZiB: (v: number) => Flat<DataSizeBuilderShortBase & ShortValues>;
468
+
469
+ export { AccessMap, AsyncQueue, B, type DebouncedFunction, type DeepPartial, type DeepRequired, EB, EiB, type Entries, type Flat, GB, GiB, KiB, MB, type Merge, MiB, type Mutable, type NonNullable, type Nullable, PB, PiB, TB, TiB, TimedMap, type TupleOf, type ValueOf, ZB, ZiB, bigIntPower, bytes, chance, chunk, clamp, convertBase, cycle, d, days, debounce, deepEqual, deferred, exabytes, exbibytes, gibibytes, gigabytes, h, hours, inRange, kB, kibibytes, kilobytes, lerp, m, mebibytes, megabytes, milliseconds, minutes, ms, noop, omit, once, pebibytes, petabytes, pick, randInt, range, retry, rotate, roundTo, s, sample, seconds, shuffle, sleep, tap, tebibytes, terabytes, throttle, timeoutPromise, tryCatch, zebibytes, zettabytes };
package/dist/index.js CHANGED
@@ -22,8 +22,23 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  AccessMap: () => AccessMap,
24
24
  AsyncQueue: () => AsyncQueue,
25
+ B: () => B,
26
+ EB: () => EB,
27
+ EiB: () => EiB,
28
+ GB: () => GB,
29
+ GiB: () => GiB,
30
+ KiB: () => KiB,
31
+ MB: () => MB,
32
+ MiB: () => MiB,
33
+ PB: () => PB,
34
+ PiB: () => PiB,
35
+ TB: () => TB,
36
+ TiB: () => TiB,
25
37
  TimedMap: () => TimedMap,
38
+ ZB: () => ZB,
39
+ ZiB: () => ZiB,
26
40
  bigIntPower: () => bigIntPower,
41
+ bytes: () => bytes,
27
42
  chance: () => chance,
28
43
  chunk: () => chunk,
29
44
  clamp: () => clamp,
@@ -34,17 +49,28 @@ __export(index_exports, {
34
49
  debounce: () => debounce,
35
50
  deepEqual: () => deepEqual,
36
51
  deferred: () => deferred,
52
+ exabytes: () => exabytes,
53
+ exbibytes: () => exbibytes,
54
+ gibibytes: () => gibibytes,
55
+ gigabytes: () => gigabytes,
37
56
  h: () => h,
38
57
  hours: () => hours,
39
58
  inRange: () => inRange,
59
+ kB: () => kB,
60
+ kibibytes: () => kibibytes,
61
+ kilobytes: () => kilobytes,
40
62
  lerp: () => lerp,
41
63
  m: () => m,
64
+ mebibytes: () => mebibytes,
65
+ megabytes: () => megabytes,
42
66
  milliseconds: () => milliseconds,
43
67
  minutes: () => minutes,
44
68
  ms: () => ms,
45
69
  noop: () => noop,
46
70
  omit: () => omit,
47
71
  once: () => once,
72
+ pebibytes: () => pebibytes,
73
+ petabytes: () => petabytes,
48
74
  pick: () => pick,
49
75
  randInt: () => randInt,
50
76
  range: () => range,
@@ -57,9 +83,13 @@ __export(index_exports, {
57
83
  shuffle: () => shuffle,
58
84
  sleep: () => sleep,
59
85
  tap: () => tap,
86
+ tebibytes: () => tebibytes,
87
+ terabytes: () => terabytes,
60
88
  throttle: () => throttle,
61
89
  timeoutPromise: () => timeoutPromise,
62
- tryCatch: () => tryCatch
90
+ tryCatch: () => tryCatch,
91
+ zebibytes: () => zebibytes,
92
+ zettabytes: () => zettabytes
63
93
  });
64
94
  module.exports = __toCommonJS(index_exports);
65
95
 
@@ -464,12 +494,162 @@ var AccessMap = class {
464
494
  this.timers.set(key, newTimer);
465
495
  }
466
496
  };
497
+
498
+ // src/datasize.ts
499
+ var dataValues = {
500
+ B: 1,
501
+ kB: 1e3,
502
+ MB: 1e6,
503
+ GB: 1e9,
504
+ TB: 1e12,
505
+ PB: 1e15,
506
+ EB: 1e18,
507
+ ZB: 1e21,
508
+ KiB: 2 ** 10,
509
+ MiB: 2 ** 20,
510
+ GiB: 2 ** 30,
511
+ TiB: 2 ** 40,
512
+ PiB: 2 ** 50,
513
+ EiB: 2 ** 60,
514
+ ZiB: 2 ** 70
515
+ };
516
+ function dataSizeLong(initialBytes = 0) {
517
+ let total = initialBytes;
518
+ const add = (v, mult) => {
519
+ total += v * mult;
520
+ return builder;
521
+ };
522
+ const builder = {
523
+ toBytes: () => total,
524
+ toKilobytes: () => total / dataValues.kB,
525
+ toMegabytes: () => total / dataValues.MB,
526
+ toGigabytes: () => total / dataValues.GB,
527
+ toTerabytes: () => total / dataValues.TB,
528
+ toPetabytes: () => total / dataValues.PB,
529
+ toExabytes: () => total / dataValues.EB,
530
+ toZettabytes: () => total / dataValues.ZB,
531
+ toKibibytes: () => total / dataValues.KiB,
532
+ toMebibytes: () => total / dataValues.MiB,
533
+ toGibibytes: () => total / dataValues.GiB,
534
+ toTebibytes: () => total / dataValues.TiB,
535
+ toPebibytes: () => total / dataValues.PiB,
536
+ toExbibytes: () => total / dataValues.EiB,
537
+ toZebibytes: () => total / dataValues.ZiB,
538
+ bytes: (v) => add(v, dataValues.B),
539
+ kilobytes: (v) => add(v, dataValues.kB),
540
+ megabytes: (v) => add(v, dataValues.MB),
541
+ gigabytes: (v) => add(v, dataValues.GB),
542
+ terabytes: (v) => add(v, dataValues.TB),
543
+ petabytes: (v) => add(v, dataValues.PB),
544
+ exabytes: (v) => add(v, dataValues.EB),
545
+ zettabytes: (v) => add(v, dataValues.ZB),
546
+ kibibytes: (v) => add(v, dataValues.KiB),
547
+ mebibytes: (v) => add(v, dataValues.MiB),
548
+ gibibytes: (v) => add(v, dataValues.GiB),
549
+ tebibytes: (v) => add(v, dataValues.TiB),
550
+ pebibytes: (v) => add(v, dataValues.PiB),
551
+ exbibytes: (v) => add(v, dataValues.EiB),
552
+ zebibytes: (v) => add(v, dataValues.ZiB)
553
+ };
554
+ return builder;
555
+ }
556
+ function dataSizeShort(initialBytes = 0) {
557
+ let total = initialBytes;
558
+ const add = (v, mult) => {
559
+ total += v * mult;
560
+ return builder;
561
+ };
562
+ const builder = {
563
+ toB: () => total,
564
+ toKB: () => total / dataValues.kB,
565
+ toMB: () => total / dataValues.MB,
566
+ toGB: () => total / dataValues.GB,
567
+ toTB: () => total / dataValues.TB,
568
+ toPB: () => total / dataValues.PB,
569
+ toEB: () => total / dataValues.EB,
570
+ toZB: () => total / dataValues.ZB,
571
+ toKiB: () => total / dataValues.KiB,
572
+ toMiB: () => total / dataValues.MiB,
573
+ toGiB: () => total / dataValues.GiB,
574
+ toTiB: () => total / dataValues.TiB,
575
+ toPiB: () => total / dataValues.PiB,
576
+ toEiB: () => total / dataValues.EiB,
577
+ toZiB: () => total / dataValues.ZiB,
578
+ B: (v) => add(v, dataValues.B),
579
+ kB: (v) => add(v, dataValues.kB),
580
+ MB: (v) => add(v, dataValues.MB),
581
+ GB: (v) => add(v, dataValues.GB),
582
+ TB: (v) => add(v, dataValues.TB),
583
+ PB: (v) => add(v, dataValues.PB),
584
+ EB: (v) => add(v, dataValues.EB),
585
+ ZB: (v) => add(v, dataValues.ZB),
586
+ KiB: (v) => add(v, dataValues.KiB),
587
+ MiB: (v) => add(v, dataValues.MiB),
588
+ GiB: (v) => add(v, dataValues.GiB),
589
+ TiB: (v) => add(v, dataValues.TiB),
590
+ PiB: (v) => add(v, dataValues.PiB),
591
+ EiB: (v) => add(v, dataValues.EiB),
592
+ ZiB: (v) => add(v, dataValues.ZiB)
593
+ };
594
+ return builder;
595
+ }
596
+ function cS2(unit) {
597
+ return (v) => dataSizeShort()[unit](v);
598
+ }
599
+ function cL2(unit) {
600
+ return (v) => dataSizeLong()[unit](v);
601
+ }
602
+ var bytes = cL2("bytes");
603
+ var kilobytes = cL2("kilobytes");
604
+ var megabytes = cL2("megabytes");
605
+ var gigabytes = cL2("gigabytes");
606
+ var terabytes = cL2("terabytes");
607
+ var petabytes = cL2("petabytes");
608
+ var exabytes = cL2("exabytes");
609
+ var zettabytes = cL2("zettabytes");
610
+ var kibibytes = cL2("kibibytes");
611
+ var mebibytes = cL2("mebibytes");
612
+ var gibibytes = cL2("gibibytes");
613
+ var tebibytes = cL2("tebibytes");
614
+ var pebibytes = cL2("pebibytes");
615
+ var exbibytes = cL2("exbibytes");
616
+ var zebibytes = cL2("zebibytes");
617
+ var B = cS2("B");
618
+ var kB = cS2("kB");
619
+ var MB = cS2("MB");
620
+ var GB = cS2("GB");
621
+ var TB = cS2("TB");
622
+ var PB = cS2("PB");
623
+ var EB = cS2("EB");
624
+ var ZB = cS2("ZB");
625
+ var KiB = cS2("KiB");
626
+ var MiB = cS2("MiB");
627
+ var GiB = cS2("GiB");
628
+ var TiB = cS2("TiB");
629
+ var PiB = cS2("PiB");
630
+ var EiB = cS2("EiB");
631
+ var ZiB = cS2("ZiB");
467
632
  // Annotate the CommonJS export names for ESM import in node:
468
633
  0 && (module.exports = {
469
634
  AccessMap,
470
635
  AsyncQueue,
636
+ B,
637
+ EB,
638
+ EiB,
639
+ GB,
640
+ GiB,
641
+ KiB,
642
+ MB,
643
+ MiB,
644
+ PB,
645
+ PiB,
646
+ TB,
647
+ TiB,
471
648
  TimedMap,
649
+ ZB,
650
+ ZiB,
472
651
  bigIntPower,
652
+ bytes,
473
653
  chance,
474
654
  chunk,
475
655
  clamp,
@@ -480,17 +660,28 @@ var AccessMap = class {
480
660
  debounce,
481
661
  deepEqual,
482
662
  deferred,
663
+ exabytes,
664
+ exbibytes,
665
+ gibibytes,
666
+ gigabytes,
483
667
  h,
484
668
  hours,
485
669
  inRange,
670
+ kB,
671
+ kibibytes,
672
+ kilobytes,
486
673
  lerp,
487
674
  m,
675
+ mebibytes,
676
+ megabytes,
488
677
  milliseconds,
489
678
  minutes,
490
679
  ms,
491
680
  noop,
492
681
  omit,
493
682
  once,
683
+ pebibytes,
684
+ petabytes,
494
685
  pick,
495
686
  randInt,
496
687
  range,
@@ -503,9 +694,15 @@ var AccessMap = class {
503
694
  shuffle,
504
695
  sleep,
505
696
  tap,
697
+ tebibytes,
698
+ terabytes,
506
699
  throttle,
507
700
  timeoutPromise,
508
- tryCatch
701
+ tryCatch,
702
+ zebibytes,
703
+ zettabytes
509
704
  });
510
705
  //! days(12).h(5).s(4).toS();
511
706
  //! d(12).hours(5).seconds(4).toS();
707
+ //! GB(12).megabytes(5).KiB(42).toB();
708
+ //! gigabytes(12).MB(5).KiB(42).toBytes();
package/dist/index.mjs CHANGED
@@ -399,11 +399,161 @@ var AccessMap = class {
399
399
  this.timers.set(key, newTimer);
400
400
  }
401
401
  };
402
+
403
+ // src/datasize.ts
404
+ var dataValues = {
405
+ B: 1,
406
+ kB: 1e3,
407
+ MB: 1e6,
408
+ GB: 1e9,
409
+ TB: 1e12,
410
+ PB: 1e15,
411
+ EB: 1e18,
412
+ ZB: 1e21,
413
+ KiB: 2 ** 10,
414
+ MiB: 2 ** 20,
415
+ GiB: 2 ** 30,
416
+ TiB: 2 ** 40,
417
+ PiB: 2 ** 50,
418
+ EiB: 2 ** 60,
419
+ ZiB: 2 ** 70
420
+ };
421
+ function dataSizeLong(initialBytes = 0) {
422
+ let total = initialBytes;
423
+ const add = (v, mult) => {
424
+ total += v * mult;
425
+ return builder;
426
+ };
427
+ const builder = {
428
+ toBytes: () => total,
429
+ toKilobytes: () => total / dataValues.kB,
430
+ toMegabytes: () => total / dataValues.MB,
431
+ toGigabytes: () => total / dataValues.GB,
432
+ toTerabytes: () => total / dataValues.TB,
433
+ toPetabytes: () => total / dataValues.PB,
434
+ toExabytes: () => total / dataValues.EB,
435
+ toZettabytes: () => total / dataValues.ZB,
436
+ toKibibytes: () => total / dataValues.KiB,
437
+ toMebibytes: () => total / dataValues.MiB,
438
+ toGibibytes: () => total / dataValues.GiB,
439
+ toTebibytes: () => total / dataValues.TiB,
440
+ toPebibytes: () => total / dataValues.PiB,
441
+ toExbibytes: () => total / dataValues.EiB,
442
+ toZebibytes: () => total / dataValues.ZiB,
443
+ bytes: (v) => add(v, dataValues.B),
444
+ kilobytes: (v) => add(v, dataValues.kB),
445
+ megabytes: (v) => add(v, dataValues.MB),
446
+ gigabytes: (v) => add(v, dataValues.GB),
447
+ terabytes: (v) => add(v, dataValues.TB),
448
+ petabytes: (v) => add(v, dataValues.PB),
449
+ exabytes: (v) => add(v, dataValues.EB),
450
+ zettabytes: (v) => add(v, dataValues.ZB),
451
+ kibibytes: (v) => add(v, dataValues.KiB),
452
+ mebibytes: (v) => add(v, dataValues.MiB),
453
+ gibibytes: (v) => add(v, dataValues.GiB),
454
+ tebibytes: (v) => add(v, dataValues.TiB),
455
+ pebibytes: (v) => add(v, dataValues.PiB),
456
+ exbibytes: (v) => add(v, dataValues.EiB),
457
+ zebibytes: (v) => add(v, dataValues.ZiB)
458
+ };
459
+ return builder;
460
+ }
461
+ function dataSizeShort(initialBytes = 0) {
462
+ let total = initialBytes;
463
+ const add = (v, mult) => {
464
+ total += v * mult;
465
+ return builder;
466
+ };
467
+ const builder = {
468
+ toB: () => total,
469
+ toKB: () => total / dataValues.kB,
470
+ toMB: () => total / dataValues.MB,
471
+ toGB: () => total / dataValues.GB,
472
+ toTB: () => total / dataValues.TB,
473
+ toPB: () => total / dataValues.PB,
474
+ toEB: () => total / dataValues.EB,
475
+ toZB: () => total / dataValues.ZB,
476
+ toKiB: () => total / dataValues.KiB,
477
+ toMiB: () => total / dataValues.MiB,
478
+ toGiB: () => total / dataValues.GiB,
479
+ toTiB: () => total / dataValues.TiB,
480
+ toPiB: () => total / dataValues.PiB,
481
+ toEiB: () => total / dataValues.EiB,
482
+ toZiB: () => total / dataValues.ZiB,
483
+ B: (v) => add(v, dataValues.B),
484
+ kB: (v) => add(v, dataValues.kB),
485
+ MB: (v) => add(v, dataValues.MB),
486
+ GB: (v) => add(v, dataValues.GB),
487
+ TB: (v) => add(v, dataValues.TB),
488
+ PB: (v) => add(v, dataValues.PB),
489
+ EB: (v) => add(v, dataValues.EB),
490
+ ZB: (v) => add(v, dataValues.ZB),
491
+ KiB: (v) => add(v, dataValues.KiB),
492
+ MiB: (v) => add(v, dataValues.MiB),
493
+ GiB: (v) => add(v, dataValues.GiB),
494
+ TiB: (v) => add(v, dataValues.TiB),
495
+ PiB: (v) => add(v, dataValues.PiB),
496
+ EiB: (v) => add(v, dataValues.EiB),
497
+ ZiB: (v) => add(v, dataValues.ZiB)
498
+ };
499
+ return builder;
500
+ }
501
+ function cS2(unit) {
502
+ return (v) => dataSizeShort()[unit](v);
503
+ }
504
+ function cL2(unit) {
505
+ return (v) => dataSizeLong()[unit](v);
506
+ }
507
+ var bytes = cL2("bytes");
508
+ var kilobytes = cL2("kilobytes");
509
+ var megabytes = cL2("megabytes");
510
+ var gigabytes = cL2("gigabytes");
511
+ var terabytes = cL2("terabytes");
512
+ var petabytes = cL2("petabytes");
513
+ var exabytes = cL2("exabytes");
514
+ var zettabytes = cL2("zettabytes");
515
+ var kibibytes = cL2("kibibytes");
516
+ var mebibytes = cL2("mebibytes");
517
+ var gibibytes = cL2("gibibytes");
518
+ var tebibytes = cL2("tebibytes");
519
+ var pebibytes = cL2("pebibytes");
520
+ var exbibytes = cL2("exbibytes");
521
+ var zebibytes = cL2("zebibytes");
522
+ var B = cS2("B");
523
+ var kB = cS2("kB");
524
+ var MB = cS2("MB");
525
+ var GB = cS2("GB");
526
+ var TB = cS2("TB");
527
+ var PB = cS2("PB");
528
+ var EB = cS2("EB");
529
+ var ZB = cS2("ZB");
530
+ var KiB = cS2("KiB");
531
+ var MiB = cS2("MiB");
532
+ var GiB = cS2("GiB");
533
+ var TiB = cS2("TiB");
534
+ var PiB = cS2("PiB");
535
+ var EiB = cS2("EiB");
536
+ var ZiB = cS2("ZiB");
402
537
  export {
403
538
  AccessMap,
404
539
  AsyncQueue,
540
+ B,
541
+ EB,
542
+ EiB,
543
+ GB,
544
+ GiB,
545
+ KiB,
546
+ MB,
547
+ MiB,
548
+ PB,
549
+ PiB,
550
+ TB,
551
+ TiB,
405
552
  TimedMap,
553
+ ZB,
554
+ ZiB,
406
555
  bigIntPower,
556
+ bytes,
407
557
  chance,
408
558
  chunk,
409
559
  clamp,
@@ -414,17 +564,28 @@ export {
414
564
  debounce,
415
565
  deepEqual,
416
566
  deferred,
567
+ exabytes,
568
+ exbibytes,
569
+ gibibytes,
570
+ gigabytes,
417
571
  h,
418
572
  hours,
419
573
  inRange,
574
+ kB,
575
+ kibibytes,
576
+ kilobytes,
420
577
  lerp,
421
578
  m,
579
+ mebibytes,
580
+ megabytes,
422
581
  milliseconds,
423
582
  minutes,
424
583
  ms,
425
584
  noop,
426
585
  omit,
427
586
  once,
587
+ pebibytes,
588
+ petabytes,
428
589
  pick,
429
590
  randInt,
430
591
  range,
@@ -437,9 +598,15 @@ export {
437
598
  shuffle,
438
599
  sleep,
439
600
  tap,
601
+ tebibytes,
602
+ terabytes,
440
603
  throttle,
441
604
  timeoutPromise,
442
- tryCatch
605
+ tryCatch,
606
+ zebibytes,
607
+ zettabytes
443
608
  };
444
609
  //! days(12).h(5).s(4).toS();
445
610
  //! d(12).hours(5).seconds(4).toS();
611
+ //! GB(12).megabytes(5).KiB(42).toB();
612
+ //! gigabytes(12).MB(5).KiB(42).toBytes();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tally.paws/toolbox",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Core utils and helpers for nodejs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",