foreslash 0.3.1 → 0.3.3

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.umd.js CHANGED
@@ -15,6 +15,57 @@ See the Mulan PSL v2 for more details.
15
15
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.foreslash = {}));
16
16
  })(this, (function (exports) { 'use strict';
17
17
 
18
+ function cartesianProduct(...arrList) {
19
+ const arrLen = arrList.length;
20
+ const pList = Array(arrLen).fill(0);
21
+ const lastIndex = arrLen - 1;
22
+ const res = [];
23
+ for (let i = 0; i < arrLen; i++) {
24
+ if (!arrList[i].length)
25
+ return [];
26
+ }
27
+ while (1) {
28
+ const temp = [];
29
+ for (let i = 0; i < arrLen; i++) {
30
+ temp.push(arrList[i][pList[i]]);
31
+ }
32
+ res.push(temp);
33
+ pList[lastIndex] += 1;
34
+ for (let i = lastIndex; i >= 0; i--) {
35
+ if (pList[i] >= arrList[i].length) {
36
+ if (i > 0) {
37
+ pList[i] = 0;
38
+ pList[i - 1] += 1;
39
+ }
40
+ else
41
+ break;
42
+ }
43
+ else
44
+ break;
45
+ }
46
+ if (pList[0] >= arrList[0].length)
47
+ break;
48
+ }
49
+ return res;
50
+ }
51
+
52
+ function castArray(value) {
53
+ return Array.isArray(value) ? value.slice() : [value];
54
+ }
55
+
56
+ function chunk(array, size = 2) {
57
+ const res = [];
58
+ if (size < 1 || isNaN(size))
59
+ return res;
60
+ let start = 0, end = size;
61
+ while (start < array.length) {
62
+ res.push(Array.prototype.slice.call(array, start, end));
63
+ start = end;
64
+ end += size;
65
+ }
66
+ return res;
67
+ }
68
+
18
69
  function range(start, end, stepOrOptions) {
19
70
  if (!isFinite(start))
20
71
  throw new Error('start must be finite');
@@ -206,6 +257,22 @@ See the Mulan PSL v2 for more details.
206
257
  return typeof value === 'number';
207
258
  }
208
259
 
260
+ const fnToString = Function.prototype.toString;
261
+ const objProtoContString = fnToString.call(Object.prototype.constructor);
262
+ function isPlainObject(value) {
263
+ if (typeof value !== 'object' || value === null)
264
+ return false;
265
+ const prototype = Object.getPrototypeOf(value);
266
+ if (prototype === null)
267
+ return true;
268
+ if (!Object.prototype.hasOwnProperty.call(prototype, "constructor"))
269
+ return false;
270
+ const constructorFn = prototype.constructor;
271
+ if (!isFunction(constructorFn) || fnToString.call(constructorFn) !== objProtoContString)
272
+ return false;
273
+ return (Object.getPrototypeOf(prototype) === null);
274
+ }
275
+
209
276
  function isPrimitive(value) {
210
277
  return value === undefined || value === null || (typeof value !== 'object' && typeof value !== 'function');
211
278
  }
@@ -378,6 +445,373 @@ See the Mulan PSL v2 for more details.
378
445
  return num < min ? defaultMin : num > max ? defaultMax : num;
379
446
  }
380
447
 
448
+ function decimalNotation(num) {
449
+ const n = isNumber(num) ? num : Number(num);
450
+ if (!isFinite(n))
451
+ return String(n);
452
+ let str = String(n);
453
+ if (!/e/i.test(str))
454
+ return str;
455
+ const match = str.match(/^(-?)(\d+)\.?(\d*)e([+-]?)(\d+)$/);
456
+ const [_, sign, mantissaI, mantissaF, expSign, _exponent] = match;
457
+ const exponent = Number(_exponent);
458
+ let mantissa = mantissaI + mantissaF;
459
+ let dotPos = mantissaI.length;
460
+ if (expSign === '-') {
461
+ const zeroCount = exponent - dotPos + 1;
462
+ if (zeroCount > 0)
463
+ mantissa = '0'.repeat(zeroCount) + mantissa;
464
+ return sign + mantissa[0] + '.' + mantissa.substring(1);
465
+ }
466
+ else {
467
+ const zeroCount = exponent + dotPos - mantissa.length;
468
+ if (zeroCount > 0)
469
+ mantissa = mantissa + '0'.repeat(zeroCount);
470
+ return sign + mantissa.substring(0, exponent + dotPos);
471
+ }
472
+ }
473
+
474
+ function isOdd(num) {
475
+ return !!(num & 1);
476
+ }
477
+ function isEven(num) {
478
+ return !(num & 1);
479
+ }
480
+
481
+ function round(num, precision, type) {
482
+ const str = decimalNotation(num);
483
+ if (/NaN|Inf/.test(str))
484
+ return str;
485
+ let [_integer, _fractional] = str.split('.');
486
+ let sign = '';
487
+ if (/^-/.test(_integer)) {
488
+ _integer = _integer.substring(1);
489
+ sign = '-';
490
+ }
491
+ _fractional = _fractional !== null && _fractional !== void 0 ? _fractional : '';
492
+ const roundMap = { round: roundBase, banker: roundBank, floor: roundFloor, ceil: roundCeil };
493
+ const [integer, fractional] = (roundMap[type || 'round'] || roundBase)(_integer, _fractional, precision, !!sign);
494
+ if (precision > 0)
495
+ return sign + integer + '.' + fractional;
496
+ else
497
+ return sign + integer;
498
+ }
499
+ function roundBase(integer, fractional, precision) {
500
+ if (fractional.length > precision) {
501
+ const splitF = fractional.substring(0, precision);
502
+ if (Number(fractional[precision]) > 4)
503
+ return increase(integer, splitF);
504
+ return [integer, splitF];
505
+ }
506
+ if (fractional.length < precision) {
507
+ fractional += '0'.repeat(precision - fractional.length);
508
+ }
509
+ return [integer, fractional];
510
+ }
511
+ function roundBank(integer, fractional, precision) {
512
+ if (fractional.length > precision) {
513
+ const splitF = fractional.substring(0, precision);
514
+ const rightNumber = Number(fractional[precision]);
515
+ if (rightNumber < 5)
516
+ return [integer, splitF];
517
+ if (rightNumber > 5)
518
+ return increase(integer, splitF);
519
+ const rightNumbers = fractional.substring(precision);
520
+ if (!/^50*$/.test(rightNumbers))
521
+ return increase(integer, splitF);
522
+ const leftNumber = Number(precision ? fractional[precision - 1] : integer[integer.length - 1]);
523
+ if (isEven(leftNumber))
524
+ return [integer, splitF];
525
+ else
526
+ return increase(integer, splitF);
527
+ }
528
+ if (fractional.length < precision) {
529
+ fractional += '0'.repeat(precision - fractional.length);
530
+ }
531
+ return [integer, fractional];
532
+ }
533
+ function roundFloor(integer, fractional, precision, isNegative) {
534
+ if (fractional.length > precision) {
535
+ const splitF = fractional.substring(0, precision);
536
+ if (isNegative)
537
+ return increase(integer, splitF);
538
+ return [integer, splitF];
539
+ }
540
+ if (fractional.length < precision) {
541
+ fractional += '0'.repeat(precision - fractional.length);
542
+ }
543
+ return [integer, fractional];
544
+ }
545
+ function roundCeil(integer, fractional, precision, isNegative) {
546
+ if (fractional.length > precision) {
547
+ const splitF = fractional.substring(0, precision);
548
+ if (!isNegative)
549
+ return increase(integer, splitF);
550
+ return [integer, splitF];
551
+ }
552
+ if (fractional.length < precision) {
553
+ fractional += '0'.repeat(precision - fractional.length);
554
+ }
555
+ return [integer, fractional];
556
+ }
557
+ function increase(integer, fractional) {
558
+ if (fractional) {
559
+ const _fractional = _increase(fractional);
560
+ if (_fractional.length > fractional.length) {
561
+ return [_increase(integer), _fractional.substring(1)];
562
+ }
563
+ return [integer, _fractional];
564
+ }
565
+ return [_increase(integer), ''];
566
+ }
567
+ function _increase(num) {
568
+ const numList = num.split('').map(Number).reverse();
569
+ numList[0] += 1;
570
+ numList.push(0);
571
+ for (let i = 0; i < numList.length; i++) {
572
+ if (numList[i] > 9) {
573
+ numList[i] -= 10;
574
+ numList[i + 1] += 1;
575
+ }
576
+ else
577
+ break;
578
+ }
579
+ if (numList[numList.length - 1] === 0)
580
+ numList.pop();
581
+ return numList.reverse().map(String).join('');
582
+ }
583
+
584
+ function format(num, options) {
585
+ var _a;
586
+ const str = decimalNotation(num);
587
+ if (/NaN|Inf/.test(str))
588
+ return str;
589
+ const separator = (options || {}).separator || ',';
590
+ const separate = clamp((options || {}).separate || 3, 1, Infinity);
591
+ const decimal = (options || {}).decimal || '.';
592
+ const precision = clamp((_a = (options || {}).precision) !== null && _a !== void 0 ? _a : 2, 0, Infinity);
593
+ const round = (options || {}).round || 'round';
594
+ let [integer, fractional] = str.split('.');
595
+ let sign = '';
596
+ if (/^-/.test(integer)) {
597
+ integer = integer.substring(1);
598
+ sign = '-';
599
+ }
600
+ fractional = fractional !== null && fractional !== void 0 ? fractional : '';
601
+ if (fractional.length > precision) {
602
+ const roundMap = { round: roundBase, banker: roundBank, floor: roundFloor, ceil: roundCeil };
603
+ [integer, fractional] = (roundMap[round] || roundBase)(integer, fractional, precision, !!sign);
604
+ }
605
+ else if (fractional.length < precision) {
606
+ fractional += '0'.repeat(precision - fractional.length);
607
+ }
608
+ if (integer.length > separate) {
609
+ integer = chunk(Array.from(integer).reverse(), separate)
610
+ .map((part) => part.join(''))
611
+ .join(separator);
612
+ integer = Array.from(integer).reverse().join('');
613
+ }
614
+ if (precision > 0)
615
+ return sign + integer + decimal + fractional;
616
+ else
617
+ return sign + integer;
618
+ }
619
+
620
+ function lerp(val1, val2, t) {
621
+ if (isNumber(val1)) {
622
+ if (!isNumber(val2))
623
+ throw new Error('Invalid val2 parameter: val2 should be a number');
624
+ return _lerp(val1, val2, t);
625
+ }
626
+ else if (isArray(val1)) {
627
+ if (!isArray(val2))
628
+ throw new Error('Invalid val2 parameter: val2 should be an Array');
629
+ if (val1.length !== val2.length) {
630
+ throw new Error(`Invalid val2 parameter: the length of val2 (${val2.length}) should be consistent with val1 (${val1.length})`);
631
+ }
632
+ if (val1.length === 0)
633
+ return [];
634
+ if (isNumber(val1[0])) {
635
+ if (!isNumber(val2[0]))
636
+ throw new Error('Invalid val2 parameter: val2 should be an Array<number>');
637
+ return val1.map((v1, index) => _lerp(v1, val2[index], t));
638
+ }
639
+ else if (isArray(val1[0])) {
640
+ const res = [];
641
+ for (let i = 0; i < val1.length; i++) {
642
+ const arr1 = val1[i];
643
+ const arr2 = val2[i];
644
+ if (arr1.length !== arr2.length) {
645
+ throw new Error(`Invalid val2 parameter: The length of array at index ${i} in val2 (${arr2.length}) must match the length of the corresponding array in val1 (${arr1.length})`);
646
+ }
647
+ res.push(arr1.map((v1, index) => _lerp(v1, arr2[index], t)));
648
+ }
649
+ return res;
650
+ }
651
+ }
652
+ throw new Error('Invalid val1 parameter: val1 should be a number or Array');
653
+ }
654
+ function _lerp(val1, val2, t) {
655
+ return val1 + (val2 - val1) * t;
656
+ }
657
+
658
+ function romanNumerals(num, options) {
659
+ const str = decimalNotation(num);
660
+ if (/NaN|Inf/.test(str))
661
+ return str;
662
+ const type = (options || {}).type || 'unicode';
663
+ const thousand = (options || {}).thousand || 'normal';
664
+ const forceSplitThousand = thousand === 'strict';
665
+ const integer = str.split('.')[0].replace('-', '');
666
+ if (integer === '0') {
667
+ const zero = (options || {}).zero || '0';
668
+ if (type === 'json')
669
+ return `["${zero}"]`;
670
+ else
671
+ return zero;
672
+ }
673
+ if (integer === '1') {
674
+ const one = (options || {}).one || 'I';
675
+ if (type === 'json')
676
+ return `["${one}"]`;
677
+ else
678
+ return one;
679
+ }
680
+ const chunks = chunk(Array.from(integer).reverse(), 3);
681
+ const romanChunks = [];
682
+ for (let i = 0; i < chunks.length; i++) {
683
+ const val = Number(chunks[i].reverse().join(''));
684
+ if (i === chunks.length - 2 && !forceSplitThousand && Number(chunks[i + 1]) < 4) {
685
+ romanChunks.push(number2roman(val + Number(chunks[i + 1]) * 1000));
686
+ break;
687
+ }
688
+ else {
689
+ romanChunks.push(number2roman(val));
690
+ }
691
+ }
692
+ switch (type) {
693
+ case 'js':
694
+ return romanChunks
695
+ .map((str, index) => str
696
+ .split('')
697
+ .map((s) => s + '\\\\u0305'.repeat(index))
698
+ .join(''))
699
+ .reverse()
700
+ .join('');
701
+ case 'html':
702
+ return romanChunks
703
+ .map((str, index) => str
704
+ .split('')
705
+ .map((s) => s + '&#x0305;'.repeat(index))
706
+ .join(''))
707
+ .reverse()
708
+ .join('');
709
+ case 'json':
710
+ return `[${romanChunks.map((str) => `"${str}"`).join(', ')}]`;
711
+ case 'unicode':
712
+ default:
713
+ return romanChunks
714
+ .map((str, index) => str
715
+ .split('')
716
+ .map((s) => s + '\u0305'.repeat(index))
717
+ .join(''))
718
+ .reverse()
719
+ .join('');
720
+ }
721
+ }
722
+ function number2roman(num) {
723
+ const symbols = [
724
+ [1000, 'M'],
725
+ [900, 'CM'],
726
+ [500, 'D'],
727
+ [400, 'CD'],
728
+ [100, 'C'],
729
+ [90, 'XC'],
730
+ [50, 'L'],
731
+ [40, 'XL'],
732
+ [10, 'X'],
733
+ [9, 'IX'],
734
+ [5, 'V'],
735
+ [4, 'IV'],
736
+ [1, 'I'],
737
+ ];
738
+ let roman = '';
739
+ for (const [val, str] of symbols) {
740
+ while (num >= val) {
741
+ num -= val;
742
+ roman += str;
743
+ }
744
+ if (num == 0)
745
+ break;
746
+ }
747
+ return roman;
748
+ }
749
+
750
+ function scientificNotation(num, options) {
751
+ const str = decimalNotation(num);
752
+ if (/NaN|Inf/.test(str))
753
+ return str;
754
+ const type = (options || {}).type || 'unicode';
755
+ const _precision = (options || {}).precision;
756
+ const precision = isNumber(_precision) ? clamp(_precision !== null && _precision !== void 0 ? _precision : 2, 0, Infinity) : null;
757
+ const round = (options || {}).round || 'round';
758
+ let [integer, fractional] = str.split('.');
759
+ let sign = '';
760
+ if (/^-/.test(integer)) {
761
+ integer = integer.substring(1);
762
+ sign = '-';
763
+ }
764
+ fractional = fractional !== null && fractional !== void 0 ? fractional : '';
765
+ let exp = 0;
766
+ let n = '';
767
+ if (integer === '0') {
768
+ exp = /^(0+)/.test(fractional) ? -(fractional.match(/^(0+)/)[0].length + 1) : -1;
769
+ [integer, fractional] = [fractional.slice(-exp - 1, -exp), fractional.slice(-exp)];
770
+ }
771
+ else {
772
+ exp = integer.length - 1;
773
+ [integer, fractional] = [integer.slice(0, 1), integer.slice(1) + fractional];
774
+ }
775
+ if (isNumber(precision)) {
776
+ if (fractional.length > precision) {
777
+ const roundMap = { round: roundBase, banker: roundBank, floor: roundFloor, ceil: roundCeil };
778
+ [integer, fractional] = (roundMap[round] || roundBase)(integer, fractional, precision, !!sign);
779
+ }
780
+ else if (fractional.length < precision) {
781
+ fractional += '0'.repeat(precision - fractional.length);
782
+ }
783
+ }
784
+ else {
785
+ fractional = fractional.replace(/0+$/, '');
786
+ }
787
+ if ((precision === null && fractional) || (isNumber(precision) && precision > 0)) {
788
+ n = sign + integer + '.' + fractional;
789
+ }
790
+ else
791
+ n = sign + integer;
792
+ switch (type) {
793
+ case 'exp':
794
+ return `${n}e${exp < 0 ? '' : '+'}${exp}`;
795
+ case 'js':
796
+ return `${n}*10**${exp}`;
797
+ case 'code':
798
+ return `${n}*10^${exp}`;
799
+ case 'html':
800
+ return `${n}&#x00d7;10<sup>${exp}</sup>`;
801
+ case 'json':
802
+ return `{"number":"${n}","exp":${exp}}`;
803
+ case 'unicode':
804
+ default:
805
+ return `${n}×10${transferNumberToUniCode(String(exp))}`;
806
+ }
807
+ }
808
+ function transferNumberToUniCode(n) {
809
+ const strMap = Object.assign(Object.assign({}, Array.from('⁰¹²³⁴⁵⁶⁷⁸⁹')), { '-': '⁻', '+': '⁺' });
810
+ return Array.from(n)
811
+ .map((s) => (strMap[s] ? strMap[s] : s))
812
+ .join('');
813
+ }
814
+
381
815
  function parallel(args, fn, options) {
382
816
  return __awaiter(this, void 0, void 0, function* () {
383
817
  if (!args.length)
@@ -1009,6 +1443,54 @@ See the Mulan PSL v2 for more details.
1009
1443
  return arr[index];
1010
1444
  }
1011
1445
 
1446
+ function randomDistribution(p, options) {
1447
+ const threshold = (options === null || options === void 0 ? void 0 : options.threshold) ? Math.max(options.threshold, Number.MIN_VALUE * 2) : 5e-6;
1448
+ const C = getInitP(p, threshold);
1449
+ let current = C;
1450
+ return function getRandomDistribution() {
1451
+ const res = Math.random() < current;
1452
+ if (res)
1453
+ current = C;
1454
+ else
1455
+ current += C;
1456
+ return res;
1457
+ };
1458
+ }
1459
+ function getInitP(targetP, threshold = 5e-6) {
1460
+ if (targetP <= 0)
1461
+ return 0;
1462
+ if (targetP >= 1)
1463
+ return 1;
1464
+ let [down, up] = [0, 1];
1465
+ let mid = 1;
1466
+ let tempP = 1;
1467
+ let tempPLast = 1;
1468
+ let step = 64;
1469
+ while (step-- > 0) {
1470
+ mid = (down + up) / 2;
1471
+ tempP = getRealPFromInitP(mid);
1472
+ if (Math.abs(tempPLast - tempP) < threshold)
1473
+ break;
1474
+ if (tempP > targetP)
1475
+ up = mid;
1476
+ else
1477
+ down = mid;
1478
+ }
1479
+ return mid;
1480
+ }
1481
+ function getRealPFromInitP(initP) {
1482
+ let sum = 0;
1483
+ let prod = 0;
1484
+ let cur = 0;
1485
+ let max = Math.ceil(1 / initP);
1486
+ for (let n = 1; n <= max; n++) {
1487
+ cur = Math.min(1, n * initP) * (1 - prod);
1488
+ prod += cur;
1489
+ sum += n * cur;
1490
+ }
1491
+ return 1 / sum;
1492
+ }
1493
+
1012
1494
  const radix32 = '0123456789abcdefghijklmnopqrstuv';
1013
1495
  const base32Chars = 'abcdefghijklmnopqrstuvwxyz234567';
1014
1496
  const base32Crockford = '0123456789abcdefghjkmnpqrstvwxyz';
@@ -1635,22 +2117,22 @@ See the Mulan PSL v2 for more details.
1635
2117
  if (isFormData(obj))
1636
2118
  return _cloneFormData(obj, map, _deepClone, options);
1637
2119
  let res;
1638
- if (obj instanceof Date) {
2120
+ if (isDate(obj)) {
1639
2121
  res = new Date(obj.valueOf());
1640
2122
  map.set(obj, res);
1641
2123
  }
1642
- else if (obj instanceof RegExp) {
2124
+ else if (isRegExp(obj)) {
1643
2125
  res = new RegExp(obj.source, obj.flags);
1644
2126
  map.set(obj, res);
1645
2127
  }
1646
- else if (obj instanceof ArrayBuffer) {
2128
+ else if (isArrayBuffer(obj)) {
1647
2129
  res = _cloneArrayBuffer(obj, map);
1648
2130
  }
1649
2131
  else if (isTypedArray(obj)) {
1650
2132
  res = new obj.constructor(_cloneArrayBuffer(obj.buffer, map), obj.byteOffset, obj.length);
1651
2133
  map.set(obj, res);
1652
2134
  }
1653
- else if (obj instanceof DataView) {
2135
+ else if (isDataView(obj)) {
1654
2136
  res = new DataView(map.has(obj.buffer) ? map.get(obj.buffer) : _cloneArrayBuffer(obj.buffer, map), obj.byteOffset, obj.byteLength);
1655
2137
  map.set(obj, res);
1656
2138
  }
@@ -2052,23 +2534,29 @@ See the Mulan PSL v2 for more details.
2052
2534
  exports.acceptableFileType = acceptableFileType;
2053
2535
  exports.camelCase = camelCase;
2054
2536
  exports.capitalize = capitalize;
2537
+ exports.cartesianProduct = cartesianProduct;
2055
2538
  exports.caseCamel = caseCamel;
2056
2539
  exports.caseConvert = caseConvert;
2057
2540
  exports.caseKebab = caseKebab;
2058
2541
  exports.casePascal = casePascal;
2059
2542
  exports.caseSnake = caseSnake;
2543
+ exports.castArray = castArray;
2544
+ exports.chunk = chunk;
2060
2545
  exports.clamp = clamp;
2061
2546
  exports.compose = compose;
2062
2547
  exports.curry = _curryMore;
2063
2548
  exports.debounce = debounce;
2549
+ exports.decimalNotation = decimalNotation;
2064
2550
  exports.dedent = dedent;
2065
2551
  exports.deepClone = deepClone;
2066
2552
  exports.deepMerge = deepMerge;
2067
2553
  exports.defer = defer;
2068
2554
  exports.fastClone = fastClone;
2555
+ exports.format = format;
2069
2556
  exports.getAcceptableExtByMIME = getAcceptableExtByMIME;
2070
2557
  exports.getAcceptableMIMEByExt = getAcceptableMIMEByExt;
2071
2558
  exports.getGlobalThis = getGlobalThis;
2559
+ exports.getInitP = getInitP;
2072
2560
  exports.getTag = getTag;
2073
2561
  exports.indent = indent;
2074
2562
  exports.isArray = isArray;
@@ -2083,6 +2571,7 @@ See the Mulan PSL v2 for more details.
2083
2571
  exports.isDataView = isDataView;
2084
2572
  exports.isDate = isDate;
2085
2573
  exports.isEmpty = isEmpty;
2574
+ exports.isEven = isEven;
2086
2575
  exports.isFile = isFile;
2087
2576
  exports.isFloat32Array = isFloat32Array;
2088
2577
  exports.isFloat64Array = isFloat64Array;
@@ -2099,7 +2588,9 @@ See the Mulan PSL v2 for more details.
2099
2588
  exports.isNull = isNull;
2100
2589
  exports.isNumber = isNumber;
2101
2590
  exports.isObject = isObject;
2591
+ exports.isOdd = isOdd;
2102
2592
  exports.isPlaceholder = isPlaceholder;
2593
+ exports.isPlainObject = isPlainObject;
2103
2594
  exports.isPrimitive = isPrimitive;
2104
2595
  exports.isPromise = isPromise;
2105
2596
  exports.isPromiseLike = isPromiseLike;
@@ -2122,6 +2613,7 @@ See the Mulan PSL v2 for more details.
2122
2613
  exports.isWrapperString = isWrapperString;
2123
2614
  exports.isWrapperSymbol = isWrapperSymbol;
2124
2615
  exports.kebabCase = kebabCase;
2616
+ exports.lerp = lerp;
2125
2617
  exports.memo = memo;
2126
2618
  exports.noop = noop;
2127
2619
  exports.not = not;
@@ -2132,6 +2624,7 @@ See the Mulan PSL v2 for more details.
2132
2624
  exports.pipe = pipe;
2133
2625
  exports.randomBase32String = randomBase32String;
2134
2626
  exports.randomChoice = randomChoice;
2627
+ exports.randomDistribution = randomDistribution;
2135
2628
  exports.randomHexString = randomHexString;
2136
2629
  exports.randomInt = randomInt;
2137
2630
  exports.randomIntFloor = randomIntFloor;
@@ -2139,6 +2632,13 @@ See the Mulan PSL v2 for more details.
2139
2632
  exports.range = range;
2140
2633
  exports.remove = remove;
2141
2634
  exports.retry = retry;
2635
+ exports.romanNumerals = romanNumerals;
2636
+ exports.round = round;
2637
+ exports.roundBank = roundBank;
2638
+ exports.roundBase = roundBase;
2639
+ exports.roundCeil = roundCeil;
2640
+ exports.roundFloor = roundFloor;
2641
+ exports.scientificNotation = scientificNotation;
2142
2642
  exports.shuffle = shuffle;
2143
2643
  exports.sleep = sleep;
2144
2644
  exports.snakeCase = snakeCase;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foreslash",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Foreslash is a Javascript utilities lib which contains plenty of practical functions.",
5
5
  "author": "moushu",
6
6
  "license": "Mulan PSL v2",
@@ -35,11 +35,11 @@
35
35
  "scripts": {
36
36
  "dev": "rollup -c -w",
37
37
  "build": "rollup -c",
38
- "test": "jest --coverage",
39
- "prepublishOnly": "npm run build && npm run test",
40
- "docs:dev": "vitepress dev docs",
41
- "docs:build": "vitepress build docs",
42
- "docs:preview": "vitepress preview docs"
38
+ "test": "tsd --files /test/**/*.test-d.ts && jest --coverage",
39
+ "prepublishOnly": "jest --coverage && npm run build",
40
+ "docs:dev": "rollup -c && vitepress dev docs",
41
+ "docs:build": "rollup -c && vitepress build docs",
42
+ "docs:preview": "rollup -c && vitepress preview docs"
43
43
  },
44
44
  "keywords": [
45
45
  "foreslash",
@@ -57,6 +57,7 @@
57
57
  "rollup-plugin-dts": "^6.2.1",
58
58
  "sass-embedded": "^1.90.0",
59
59
  "ts-jest": "^29.2.5",
60
+ "tsd": "^0.33.0",
60
61
  "tslib": "^2.7.0",
61
62
  "typescript": "^5.5.4",
62
63
  "vitepress": "^1.6.3",