@zelgadis87/utils-core 4.10.0 → 4.11.0
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/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/functions/constant.d.ts +1 -0
- package/dist/utils/functions/pipedInvokeFromArray.d.ts +2 -0
- package/dist/utils/functions.d.ts +11 -0
- package/dist/utils/numbers.d.ts +1 -0
- package/dist/utils/promises.d.ts +1 -0
- package/esbuild/index.cjs +30 -0
- package/esbuild/index.cjs.map +2 -2
- package/esbuild/index.mjs +25 -0
- package/esbuild/index.mjs.map +2 -2
- package/package.json +1 -1
- package/src/utils/functions/constant.ts +1 -0
- package/src/utils/functions.ts +25 -0
- package/src/utils/numbers.ts +3 -0
- package/src/utils/promises.ts +2 -1
package/esbuild/index.mjs
CHANGED
|
@@ -457,6 +457,7 @@ function identity(t) {
|
|
|
457
457
|
var constantNull = constant(null);
|
|
458
458
|
var constantTrue = constant(true);
|
|
459
459
|
var constantFalse = constant(false);
|
|
460
|
+
var constantUndefined = constant(void 0);
|
|
460
461
|
var alwaysTrue = constantTrue;
|
|
461
462
|
var alwaysFalse = constantFalse;
|
|
462
463
|
var constantZero = constant(0);
|
|
@@ -504,6 +505,20 @@ function or(...predicates) {
|
|
|
504
505
|
function xor(a, b) {
|
|
505
506
|
return (t) => a(t) !== b(t);
|
|
506
507
|
}
|
|
508
|
+
function pipedInvoke(...fns) {
|
|
509
|
+
return pipedInvokeFromArray(fns);
|
|
510
|
+
}
|
|
511
|
+
function pipedInvokeFromArray(fns) {
|
|
512
|
+
if (fns.length === 0) {
|
|
513
|
+
return identity;
|
|
514
|
+
}
|
|
515
|
+
if (fns.length === 1) {
|
|
516
|
+
return fns[0];
|
|
517
|
+
}
|
|
518
|
+
return function piped(input) {
|
|
519
|
+
return fns.reduce((prev, fn) => fn(prev), input);
|
|
520
|
+
};
|
|
521
|
+
}
|
|
507
522
|
|
|
508
523
|
// src/utils/arrays/uniqBy.ts
|
|
509
524
|
function uniq(arr) {
|
|
@@ -793,6 +808,9 @@ function clamp(n, min2, max2) {
|
|
|
793
808
|
return n;
|
|
794
809
|
}
|
|
795
810
|
}
|
|
811
|
+
function clampInt0_100(n) {
|
|
812
|
+
return clamp(Math.round(n), 0, 100);
|
|
813
|
+
}
|
|
796
814
|
function tryToParseNumber(numberStr) {
|
|
797
815
|
return withTryCatch(() => {
|
|
798
816
|
const type = typeof ensureDefined(numberStr);
|
|
@@ -833,6 +851,8 @@ async function awaitAtMost(p, t) {
|
|
|
833
851
|
throw new TimeoutError();
|
|
834
852
|
});
|
|
835
853
|
}
|
|
854
|
+
var NEVER = new Promise((_resolve) => {
|
|
855
|
+
});
|
|
836
856
|
|
|
837
857
|
// src/utils/random.ts
|
|
838
858
|
var randomInterval = (min2, max2) => randomNumberInInterval(min2, max2);
|
|
@@ -2719,6 +2739,7 @@ export {
|
|
|
2719
2739
|
Lazy,
|
|
2720
2740
|
LazyAsync,
|
|
2721
2741
|
Logger,
|
|
2742
|
+
NEVER,
|
|
2722
2743
|
Optional,
|
|
2723
2744
|
RandomTimeDuration,
|
|
2724
2745
|
RateThrottler,
|
|
@@ -2741,11 +2762,13 @@ export {
|
|
|
2741
2762
|
awaitAtMost,
|
|
2742
2763
|
capitalizeWord,
|
|
2743
2764
|
clamp,
|
|
2765
|
+
clampInt0_100,
|
|
2744
2766
|
constant,
|
|
2745
2767
|
constantFalse,
|
|
2746
2768
|
constantNull,
|
|
2747
2769
|
constantOne,
|
|
2748
2770
|
constantTrue,
|
|
2771
|
+
constantUndefined,
|
|
2749
2772
|
constantZero,
|
|
2750
2773
|
createSorterFor,
|
|
2751
2774
|
cssDeclarationRulesDictionaryToCss,
|
|
@@ -2831,6 +2854,8 @@ export {
|
|
|
2831
2854
|
padRight,
|
|
2832
2855
|
partition,
|
|
2833
2856
|
pick,
|
|
2857
|
+
pipedInvoke,
|
|
2858
|
+
pipedInvokeFromArray,
|
|
2834
2859
|
pluralize,
|
|
2835
2860
|
promiseSequence,
|
|
2836
2861
|
randomId,
|