@zelgadis87/utils-core 5.1.2 → 5.1.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/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/arrays.d.ts +1 -0
- package/dist/utils/nulls.d.ts +3 -2
- package/dist/utils/records.d.ts +1 -0
- package/dist/utils/strings.d.ts +4 -1
- package/esbuild/index.cjs +32 -4
- package/esbuild/index.cjs.map +2 -2
- package/esbuild/index.mjs +28 -3
- package/esbuild/index.mjs.map +2 -2
- package/package.json +1 -1
- package/src/utils/arrays.ts +9 -0
- package/src/utils/nulls.ts +6 -2
- package/src/utils/records.ts +10 -0
- package/src/utils/strings.ts +14 -3
package/esbuild/index.mjs
CHANGED
|
@@ -351,6 +351,11 @@ function ifNullOrUndefined(source, callback) {
|
|
|
351
351
|
if (isNullOrUndefined(source))
|
|
352
352
|
callback();
|
|
353
353
|
}
|
|
354
|
+
function throwIfNullOrUndefined(source, errorProducer = () => new Error(`Unexpected ${source} value`)) {
|
|
355
|
+
return ifNullOrUndefined(source, () => {
|
|
356
|
+
throw errorProducer();
|
|
357
|
+
});
|
|
358
|
+
}
|
|
354
359
|
|
|
355
360
|
// src/utils/arrays/groupBy.ts
|
|
356
361
|
function groupByString(arr, field) {
|
|
@@ -663,6 +668,14 @@ function sumArrayBy(arr, mapFn) {
|
|
|
663
668
|
return sum2 + value;
|
|
664
669
|
}, 0);
|
|
665
670
|
}
|
|
671
|
+
function shallowArrayEquals(a, b) {
|
|
672
|
+
if (a === b) return true;
|
|
673
|
+
if (a.length !== b.length) return false;
|
|
674
|
+
for (let i = 0; i < a.length; i++) {
|
|
675
|
+
if (a[i] !== b[i]) return false;
|
|
676
|
+
}
|
|
677
|
+
return true;
|
|
678
|
+
}
|
|
666
679
|
|
|
667
680
|
// src/utils/booleans.ts
|
|
668
681
|
function isTrue(x) {
|
|
@@ -951,6 +964,15 @@ function pick(o, keys) {
|
|
|
951
964
|
return obj;
|
|
952
965
|
}, {});
|
|
953
966
|
}
|
|
967
|
+
function shallowRecordEquals(a, b) {
|
|
968
|
+
if (a === b) return true;
|
|
969
|
+
const aKeys = Object.keys(a), bKeys = Object.keys(b);
|
|
970
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
971
|
+
for (const key of aKeys) {
|
|
972
|
+
if (a[key] !== b[key]) return false;
|
|
973
|
+
}
|
|
974
|
+
return true;
|
|
975
|
+
}
|
|
954
976
|
|
|
955
977
|
// src/utils/strings/StringParts.ts
|
|
956
978
|
var StringParts = class _StringParts {
|
|
@@ -1103,8 +1125,8 @@ function pluralize(n, singular, plural) {
|
|
|
1103
1125
|
}
|
|
1104
1126
|
return plural;
|
|
1105
1127
|
}
|
|
1106
|
-
function
|
|
1107
|
-
return
|
|
1128
|
+
function isNullOrUndefinedOrEmpty(source) {
|
|
1129
|
+
return isNullOrUndefined(source) || source.length === 0;
|
|
1108
1130
|
}
|
|
1109
1131
|
|
|
1110
1132
|
// src/lazy/Lazy.ts
|
|
@@ -2794,6 +2816,7 @@ export {
|
|
|
2794
2816
|
isFunction,
|
|
2795
2817
|
isNegativeNumber,
|
|
2796
2818
|
isNullOrUndefined,
|
|
2819
|
+
isNullOrUndefinedOrEmpty,
|
|
2797
2820
|
isNumber,
|
|
2798
2821
|
isPositiveNumber,
|
|
2799
2822
|
isTimeInstant,
|
|
@@ -2836,6 +2859,8 @@ export {
|
|
|
2836
2859
|
roundToNearest,
|
|
2837
2860
|
roundToUpper,
|
|
2838
2861
|
roundTowardsZero,
|
|
2862
|
+
shallowArrayEquals,
|
|
2863
|
+
shallowRecordEquals,
|
|
2839
2864
|
sortedArray,
|
|
2840
2865
|
splitWords,
|
|
2841
2866
|
stringToNumber,
|
|
@@ -2844,6 +2869,7 @@ export {
|
|
|
2844
2869
|
sumBy,
|
|
2845
2870
|
tail,
|
|
2846
2871
|
throttle,
|
|
2872
|
+
throwIfNullOrUndefined,
|
|
2847
2873
|
transformCssDictionary,
|
|
2848
2874
|
tryToParseJson,
|
|
2849
2875
|
tryToParseNumber,
|
|
@@ -2853,7 +2879,6 @@ export {
|
|
|
2853
2879
|
upsert,
|
|
2854
2880
|
withTryCatch,
|
|
2855
2881
|
withTryCatchAsync,
|
|
2856
|
-
wrapWithString,
|
|
2857
2882
|
xor
|
|
2858
2883
|
};
|
|
2859
2884
|
//# sourceMappingURL=index.mjs.map
|