@rzl-zone/utils-js 3.11.1 → 3.12.1-beta.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/{LICENSE.md → LICENSE} +3 -3
- package/README.md +62 -89
- package/dist/.references/index.d.cts +25 -0
- package/dist/.references/index.d.ts +25 -0
- package/dist/assertIsArray-BChqwPiP.cjs +26 -0
- package/dist/assertIsArray-BChqwPiP.cjs.map +1 -0
- package/dist/assertIsArray-BfAbIUfa.js +20 -0
- package/dist/assertIsArray-BfAbIUfa.js.map +1 -0
- package/dist/assertIsBoolean-BlBct0Fc.js +1073 -0
- package/dist/assertIsBoolean-BlBct0Fc.js.map +1 -0
- package/dist/assertIsBoolean-DozdtbNi.cjs +1283 -0
- package/dist/assertIsBoolean-DozdtbNi.cjs.map +1 -0
- package/dist/assertIsString-Bvk7bUL7.cjs +26 -0
- package/dist/assertIsString-Bvk7bUL7.cjs.map +1 -0
- package/dist/assertIsString-DqV9NwbI.js +20 -0
- package/dist/assertIsString-DqV9NwbI.js.map +1 -0
- package/dist/assertions/index.cjs +37 -40
- package/dist/assertions/index.cjs.map +1 -0
- package/dist/assertions/index.d.cts +12 -0
- package/dist/assertions/index.d.ts +10 -824
- package/dist/assertions/index.js +30 -13
- package/dist/assertions/index.js.map +1 -0
- package/dist/conversions/index.cjs +34 -103
- package/dist/conversions/index.d.cts +12 -0
- package/dist/conversions/index.d.ts +10 -1791
- package/dist/conversions/index.js +14 -24
- package/dist/conversions-CBs8-REq.cjs +448 -0
- package/dist/conversions-CBs8-REq.cjs.map +1 -0
- package/dist/conversions-EMJa3g-D.js +382 -0
- package/dist/conversions-EMJa3g-D.js.map +1 -0
- package/dist/events/index.cjs +55 -31
- package/dist/events/index.cjs.map +1 -0
- package/dist/events/index.d.cts +174 -0
- package/dist/events/index.d.ts +31 -35
- package/dist/events/index.js +50 -12
- package/dist/events/index.js.map +1 -0
- package/dist/formatEnvPort-DpIXzPAZ.js +159 -0
- package/dist/formatEnvPort-DpIXzPAZ.js.map +1 -0
- package/dist/formatEnvPort-hHNvOim-.cjs +171 -0
- package/dist/formatEnvPort-hHNvOim-.cjs.map +1 -0
- package/dist/formatters/index.cjs +21 -61
- package/dist/formatters/index.d.cts +12 -0
- package/dist/formatters/index.d.ts +10 -2152
- package/dist/formatters/index.js +10 -18
- package/dist/formatters-QcZO_Cpx.js +367 -0
- package/dist/formatters-QcZO_Cpx.js.map +1 -0
- package/dist/formatters-lAYgA11L.cjs +427 -0
- package/dist/formatters-lAYgA11L.cjs.map +1 -0
- package/dist/generators/index.cjs +161 -41
- package/dist/generators/index.cjs.map +1 -0
- package/dist/generators/index.d.cts +12 -0
- package/dist/generators/index.d.ts +10 -338
- package/dist/generators/index.js +154 -14
- package/dist/generators/index.js.map +1 -0
- package/dist/index-26W7ItWx.d.ts +760 -0
- package/dist/index-BPPQjAfs.d.cts +2359 -0
- package/dist/index-BXjlgBLz.d.cts +2139 -0
- package/dist/index-B_Wwo91H.d.ts +2359 -0
- package/dist/index-CpufydcI.d.cts +704 -0
- package/dist/index-Czc4O526.d.ts +333 -0
- package/dist/index-DPs1_p5G.d.cts +760 -0
- package/dist/index-DRpOyBSC.d.ts +1703 -0
- package/dist/index-DWWvtHUn.d.cts +822 -0
- package/dist/index-DnM0LD0n.d.cts +333 -0
- package/dist/index-GUZ9fK6T.d.ts +2139 -0
- package/dist/index-I4fAzwXV.d.ts +704 -0
- package/dist/index-JDrOl_19.d.ts +822 -0
- package/dist/index-b66P49Qe.d.cts +1703 -0
- package/dist/isBigInt-B1cijjqm.cjs +20 -0
- package/dist/isBigInt-B1cijjqm.cjs.map +1 -0
- package/dist/isBigInt-C0bN0Rhu.js +14 -0
- package/dist/isBigInt-C0bN0Rhu.js.map +1 -0
- package/dist/isEmptyObject-DI42NEo0.cjs +37 -0
- package/dist/isEmptyObject-DI42NEo0.cjs.map +1 -0
- package/dist/isEmptyObject-DeLVIJpl.js +25 -0
- package/dist/isEmptyObject-DeLVIJpl.js.map +1 -0
- package/dist/isEmptyString-BTUWYTbw.js +15 -0
- package/dist/isEmptyString-BTUWYTbw.js.map +1 -0
- package/dist/isEmptyString-CCK3bP74.cjs +21 -0
- package/dist/isEmptyString-CCK3bP74.cjs.map +1 -0
- package/dist/isEmptyValue-DMSMFTU8.cjs +30 -0
- package/dist/isEmptyValue-DMSMFTU8.cjs.map +1 -0
- package/dist/isEmptyValue-fjnfQnt5.js +24 -0
- package/dist/isEmptyValue-fjnfQnt5.js.map +1 -0
- package/dist/isEqual-B1fRgEuU.cjs +111 -0
- package/dist/isEqual-B1fRgEuU.cjs.map +1 -0
- package/dist/isEqual-DhyP8fB_.js +87 -0
- package/dist/isEqual-DhyP8fB_.js.map +1 -0
- package/dist/isFinite-BYMOo0os.js +15 -0
- package/dist/isFinite-BYMOo0os.js.map +1 -0
- package/dist/isFinite-sFkps2TY.cjs +21 -0
- package/dist/isFinite-sFkps2TY.cjs.map +1 -0
- package/dist/isInteger-DS9V7l_f.js +14 -0
- package/dist/isInteger-DS9V7l_f.js.map +1 -0
- package/dist/isInteger-FTCthMre.cjs +20 -0
- package/dist/isInteger-FTCthMre.cjs.map +1 -0
- package/dist/isPlainObject-DcFGh3_5.d.ts +530 -0
- package/dist/isPlainObject-doTI11Ib.d.cts +530 -0
- package/dist/isServer-D1TXfOs3.js +14 -0
- package/dist/isServer-D1TXfOs3.js.map +1 -0
- package/dist/isServer-q-QLFCqE.cjs +20 -0
- package/dist/isServer-q-QLFCqE.cjs.map +1 -0
- package/dist/isTypedArray-47R0wdrc.js +31 -0
- package/dist/isTypedArray-47R0wdrc.js.map +1 -0
- package/dist/isTypedArray-DiCoqffZ.cjs +43 -0
- package/dist/isTypedArray-DiCoqffZ.cjs.map +1 -0
- package/dist/isURL-CQiowFq2.js +14 -0
- package/dist/isURL-CQiowFq2.js.map +1 -0
- package/dist/isURL-WZypXsax.cjs +20 -0
- package/dist/isURL-WZypXsax.cjs.map +1 -0
- package/dist/isValidDomain-BSXshgkC.cjs +1788 -0
- package/dist/isValidDomain-BSXshgkC.cjs.map +1 -0
- package/dist/isValidDomain-DwA2EN79.js +1782 -0
- package/dist/isValidDomain-DwA2EN79.js.map +1 -0
- package/dist/next/index.cjs +119 -212
- package/dist/next/index.cjs.map +1 -0
- package/dist/next/index.d.cts +226 -0
- package/dist/next/index.d.ts +26 -31
- package/dist/next/index.js +117 -210
- package/dist/next/index.js.map +1 -0
- package/dist/next/server/index.cjs +25 -40
- package/dist/next/server/index.cjs.map +1 -0
- package/dist/next/server/index.d.cts +39 -0
- package/dist/next/server/index.d.ts +9 -10
- package/dist/next/server/index.js +23 -38
- package/dist/next/server/index.js.map +1 -0
- package/dist/noop-B2mTBhW-.cjs +18 -0
- package/dist/noop-B2mTBhW-.cjs.map +1 -0
- package/dist/noop-BzktGBVz.js +12 -0
- package/dist/noop-BzktGBVz.js.map +1 -0
- package/dist/normalizeSpaces-DQHR3Tlr.cjs +29 -0
- package/dist/normalizeSpaces-DQHR3Tlr.cjs.map +1 -0
- package/dist/normalizeSpaces-WS_iERJk.js +23 -0
- package/dist/normalizeSpaces-WS_iERJk.js.map +1 -0
- package/dist/normalizeString-2WLth_Gj.js +15 -0
- package/dist/normalizeString-2WLth_Gj.js.map +1 -0
- package/dist/normalizeString-D8euBcRD.cjs +21 -0
- package/dist/normalizeString-D8euBcRD.cjs.map +1 -0
- package/dist/operations/index.cjs +65 -32
- package/dist/operations/index.cjs.map +1 -0
- package/dist/operations/index.d.cts +139 -0
- package/dist/operations/index.d.ts +10 -15
- package/dist/operations/index.js +61 -17
- package/dist/operations/index.js.map +1 -0
- package/dist/parsers/index.cjs +12 -19
- package/dist/parsers/index.d.cts +239 -0
- package/dist/parsers/index.d.ts +71 -72
- package/dist/parsers/index.js +10 -12
- package/dist/parsers-DXtpsDyj.cjs +649 -0
- package/dist/parsers-DXtpsDyj.cjs.map +1 -0
- package/dist/parsers-Dpuq-V4u.js +643 -0
- package/dist/parsers-Dpuq-V4u.js.map +1 -0
- package/dist/parsing-B43x1sxn.js +50 -0
- package/dist/parsing-B43x1sxn.js.map +1 -0
- package/dist/parsing-lRoxn1Nz.cjs +56 -0
- package/dist/parsing-lRoxn1Nz.cjs.map +1 -0
- package/dist/predicates/index.cjs +91 -296
- package/dist/predicates/index.d.cts +13 -0
- package/dist/predicates/index.d.ts +12 -2482
- package/dist/predicates/index.js +23 -25
- package/dist/predicates-DiaYA7Ps.cjs +413 -0
- package/dist/predicates-DiaYA7Ps.cjs.map +1 -0
- package/dist/predicates-gNepszvo.js +257 -0
- package/dist/predicates-gNepszvo.js.map +1 -0
- package/dist/promises/index.cjs +76 -24
- package/dist/promises/index.cjs.map +1 -0
- package/dist/promises/index.d.cts +123 -0
- package/dist/promises/index.d.ts +28 -31
- package/dist/promises/index.js +73 -13
- package/dist/promises/index.js.map +1 -0
- package/dist/punyCode-CTWXVVFo.cjs +185 -0
- package/dist/punyCode-CTWXVVFo.cjs.map +1 -0
- package/dist/punyCode-hmiFzLWT.js +179 -0
- package/dist/punyCode-hmiFzLWT.js.map +1 -0
- package/dist/removeSpaces-BE8lfh-4.js +19 -0
- package/dist/removeSpaces-BE8lfh-4.js.map +1 -0
- package/dist/removeSpaces-DRRxNWlb.cjs +25 -0
- package/dist/removeSpaces-DRRxNWlb.cjs.map +1 -0
- package/dist/safeJsonParse-BBnQElk8.cjs +208 -0
- package/dist/safeJsonParse-BBnQElk8.cjs.map +1 -0
- package/dist/safeJsonParse-CXruaP0p.js +184 -0
- package/dist/safeJsonParse-CXruaP0p.js.map +1 -0
- package/dist/safeStableStringify-BNh3D0K0.js +88 -0
- package/dist/safeStableStringify-BNh3D0K0.js.map +1 -0
- package/dist/safeStableStringify-Cc62pfRp.cjs +106 -0
- package/dist/safeStableStringify-Cc62pfRp.cjs.map +1 -0
- package/dist/strings/index.cjs +76 -81
- package/dist/strings/index.cjs.map +1 -0
- package/dist/strings/index.d.cts +12 -0
- package/dist/strings/index.d.ts +10 -775
- package/dist/strings/index.js +59 -14
- package/dist/strings/index.js.map +1 -0
- package/dist/tailwind/index.cjs +19 -47
- package/dist/tailwind/index.d.cts +12 -0
- package/dist/tailwind/index.d.ts +11 -712
- package/dist/tailwind/index.js +10 -12
- package/dist/tailwind-DJ4cmLUw.cjs +247 -0
- package/dist/tailwind-DJ4cmLUw.cjs.map +1 -0
- package/dist/tailwind-IJvOdkZp.js +199 -0
- package/dist/tailwind-IJvOdkZp.js.map +1 -0
- package/dist/toStringArrayUnRecursive-CFs0jTEg.js +39 -0
- package/dist/toStringArrayUnRecursive-CFs0jTEg.js.map +1 -0
- package/dist/toStringArrayUnRecursive-xUaU8Ot9.cjs +51 -0
- package/dist/toStringArrayUnRecursive-xUaU8Ot9.cjs.map +1 -0
- package/dist/urls/index.cjs +129 -57
- package/dist/urls/index.cjs.map +1 -0
- package/dist/urls/index.d.cts +740 -0
- package/dist/urls/index.d.ts +218 -224
- package/dist/urls/index.js +121 -26
- package/dist/urls/index.js.map +1 -0
- package/package.json +203 -194
- package/dist/chunk-22V4WP3H.js +0 -53
- package/dist/chunk-2XSZ2ANI.js +0 -63
- package/dist/chunk-3T6VSWYX.js +0 -21
- package/dist/chunk-5WIEDF2J.js +0 -1823
- package/dist/chunk-6EDFZJZ5.cjs +0 -598
- package/dist/chunk-6LXWT2I5.js +0 -32
- package/dist/chunk-6YGBRENU.js +0 -209
- package/dist/chunk-7FGNVDEV.cjs +0 -38
- package/dist/chunk-AXDYWO67.js +0 -119
- package/dist/chunk-B6PMNZ4M.cjs +0 -35
- package/dist/chunk-BAV5T2E3.cjs +0 -15
- package/dist/chunk-BLF7SD66.js +0 -95
- package/dist/chunk-BMZZXZJ2.cjs +0 -30
- package/dist/chunk-BOYP3ARU.js +0 -264
- package/dist/chunk-BPYW5YL7.js +0 -16
- package/dist/chunk-C2PV3VWC.cjs +0 -118
- package/dist/chunk-CCJ2MSN7.js +0 -16
- package/dist/chunk-DAPAK2W3.cjs +0 -123
- package/dist/chunk-DLS3G6WQ.cjs +0 -23
- package/dist/chunk-DNMCR5JH.js +0 -370
- package/dist/chunk-DVMHRLKP.cjs +0 -16
- package/dist/chunk-EBYFYZW4.cjs +0 -26
- package/dist/chunk-ENMRZ4BE.js +0 -302
- package/dist/chunk-FJ4BQFVO.js +0 -587
- package/dist/chunk-GIKL4PUF.cjs +0 -106
- package/dist/chunk-GOFINGT6.js +0 -35
- package/dist/chunk-GXKQ3LHF.js +0 -101
- package/dist/chunk-HNBRGN4R.js +0 -24
- package/dist/chunk-HYN6FC5A.cjs +0 -249
- package/dist/chunk-IZGVBYFN.js +0 -242
- package/dist/chunk-JIE447J5.js +0 -676
- package/dist/chunk-JXEIJM5M.cjs +0 -237
- package/dist/chunk-K47GZDBH.js +0 -115
- package/dist/chunk-K5536YHG.cjs +0 -269
- package/dist/chunk-KHO2SBNA.cjs +0 -16
- package/dist/chunk-KXJ7X325.cjs +0 -308
- package/dist/chunk-L5RDAVVH.js +0 -14
- package/dist/chunk-LJHPTLWB.js +0 -109
- package/dist/chunk-M7ELWZXM.cjs +0 -1825
- package/dist/chunk-MSUW5VHZ.js +0 -1590
- package/dist/chunk-MUHRPRR7.cjs +0 -65
- package/dist/chunk-MV3TSQSH.cjs +0 -397
- package/dist/chunk-NLZLXWAU.cjs +0 -678
- package/dist/chunk-NVRZPF5M.cjs +0 -18
- package/dist/chunk-ONZFBJVW.js +0 -14
- package/dist/chunk-PGNL7JXO.cjs +0 -251
- package/dist/chunk-Q4GEQS7X.cjs +0 -564
- package/dist/chunk-QNKGP5DY.js +0 -14
- package/dist/chunk-QYI2VJLS.cjs +0 -211
- package/dist/chunk-RBWZII5I.js +0 -59
- package/dist/chunk-RMP7VMPB.cjs +0 -33
- package/dist/chunk-RZOGBYIS.js +0 -21
- package/dist/chunk-SU3UELUB.cjs +0 -36
- package/dist/chunk-SYHPSOUU.cjs +0 -1626
- package/dist/chunk-SZUNAEMR.js +0 -246
- package/dist/chunk-TER22LO4.cjs +0 -64
- package/dist/chunk-TJHGRQ4P.js +0 -33
- package/dist/chunk-U23I7JPB.cjs +0 -56
- package/dist/chunk-U7HHN47R.js +0 -552
- package/dist/chunk-UDA26MCU.cjs +0 -16
- package/dist/chunk-UIAWUZ4H.js +0 -31
- package/dist/chunk-ULQPCIA2.js +0 -16
- package/dist/chunk-VJDDGRIK.cjs +0 -16
- package/dist/chunk-WETQI6HM.js +0 -232
- package/dist/chunk-WLOQQFDS.cjs +0 -18
- package/dist/chunk-WVSPXFTY.js +0 -14
- package/dist/chunk-WXFTVXBF.cjs +0 -23
- package/dist/chunk-XPVTIGU2.cjs +0 -113
- package/dist/chunk-XX6RUGTM.cjs +0 -18
- package/dist/chunk-YWHHVDT4.js +0 -13
- package/dist/chunk-ZPDMWDGZ.cjs +0 -101
- package/dist/chunk-ZVWZEGQP.js +0 -28
- package/dist/index.d.ts +0 -24
- package/dist/isPlainObject-0p3VveWr.d.ts +0 -534
- package/dist/rzl-utils.global.js +0 -10
package/dist/chunk-DNMCR5JH.js
DELETED
|
@@ -1,370 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* ====================================================
|
|
3
|
-
* Rzl Utils-JS.
|
|
4
|
-
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.11.1.
|
|
6
|
-
* Author: Rizalvin Dwiky.
|
|
7
|
-
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
|
-
* ====================================================
|
|
9
|
-
*/
|
|
10
|
-
import { isURL } from './chunk-ONZFBJVW.js';
|
|
11
|
-
import { isTypedArray } from './chunk-TJHGRQ4P.js';
|
|
12
|
-
import { parseCurrencyString } from './chunk-2XSZ2ANI.js';
|
|
13
|
-
import { isEmptyString } from './chunk-ULQPCIA2.js';
|
|
14
|
-
import { assertIsString } from './chunk-3T6VSWYX.js';
|
|
15
|
-
import { isEqual, isRegExp, baseDeepEqual } from './chunk-GXKQ3LHF.js';
|
|
16
|
-
import { isEmptyArray } from './chunk-GOFINGT6.js';
|
|
17
|
-
import { safeStableStringify, isDate, isMap } from './chunk-AXDYWO67.js';
|
|
18
|
-
import { isArray, getPreciseType, assertIsBoolean, isNonEmptyString, assertIsPlainObject, isObjectOrArray, isFunction, isString, isNumber, isSymbol, isSet, isPlainObject, isNil, isBoolean, isBuffer, isNaN, isUndefined, isObject, isNull } from './chunk-MSUW5VHZ.js';
|
|
19
|
-
|
|
20
|
-
var areArraysEqual = (array1, array2, ignoreOrder = false) => {
|
|
21
|
-
if (!(isArray(array1) && isArray(array2))) {
|
|
22
|
-
throw new TypeError(
|
|
23
|
-
`Parameters \`array1\` and \`array2\` property of the \`options\` (second parameter) must be of type \`array\`, but received: ['array1': \`${getPreciseType(
|
|
24
|
-
array1
|
|
25
|
-
)}\`, 'array2': \`${getPreciseType(array2)}\`].`
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
assertIsBoolean(ignoreOrder, {
|
|
29
|
-
message: ({ currentType, validType }) => `Third parameter \`ignoreOrder\` must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
30
|
-
});
|
|
31
|
-
if (!isEqual(array1.length, array2.length)) return false;
|
|
32
|
-
const deepIgnoreOrder = (arr) => {
|
|
33
|
-
if (!isArray(arr)) return arr;
|
|
34
|
-
const sorted = arr.map((item) => {
|
|
35
|
-
if (isArray(item)) {
|
|
36
|
-
return deepIgnoreOrder(item);
|
|
37
|
-
}
|
|
38
|
-
return item;
|
|
39
|
-
});
|
|
40
|
-
return sorted.sort((a, b) => {
|
|
41
|
-
const sa = safeStableStringify(a);
|
|
42
|
-
const sb = safeStableStringify(b);
|
|
43
|
-
return sa < sb ? -1 : sa > sb ? 1 : 0;
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
const normalizedArr1 = ignoreOrder ? deepIgnoreOrder(array1) : array1;
|
|
47
|
-
const normalizedArr2 = ignoreOrder ? deepIgnoreOrder(array2) : array2;
|
|
48
|
-
if (!isEqual(normalizedArr1.length, normalizedArr2.length)) return false;
|
|
49
|
-
return normalizedArr1.every(
|
|
50
|
-
(item, index) => safeStableStringify(item) === safeStableStringify(normalizedArr2[index])
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
var areObjectsEqual = (object1, object2) => {
|
|
55
|
-
return isEqual(object1, object2);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
var areURLsEqualPath = (urlA, urlB) => {
|
|
59
|
-
if (!isURL(urlA) || !isURL(urlB)) {
|
|
60
|
-
throw new TypeError(
|
|
61
|
-
`Parameters \`urlA\` and \`urlB\` (first and second parameter) must be instance of URL.`
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
return urlA.protocol + "//" + urlA.host + urlA.pathname === urlB.protocol + "//" + urlB.host + urlB.pathname;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
var areURLsIdentical = (urlA, urlB) => {
|
|
68
|
-
if (!isURL(urlA) || !isURL(urlB)) {
|
|
69
|
-
throw new TypeError(
|
|
70
|
-
`Parameters \`urlA\` and \`urlB\` (first and second parameter) must be instance of URL.`
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
return urlA.protocol + "//" + urlA.host + urlA.pathname + urlA.search === urlB.protocol + "//" + urlB.host + urlB.pathname + urlB.search;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
var textContainsAll = (text, searchWords, options = {}) => {
|
|
77
|
-
if (!isNonEmptyString(text) || !isArray(searchWords)) {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
assertIsPlainObject(options, {
|
|
81
|
-
message: ({ currentType, validType }) => `Third parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
82
|
-
});
|
|
83
|
-
const { exactMatch = false, flags = "i" } = options;
|
|
84
|
-
assertIsBoolean(exactMatch, {
|
|
85
|
-
message: ({ currentType, validType }) => `Parameter \`exactMatch\` property of the \`options\` (third parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
86
|
-
});
|
|
87
|
-
assertIsString(flags, {
|
|
88
|
-
message: ({ currentType, validType }) => `Parameter \`flags\` property of the \`options\` (third parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
89
|
-
});
|
|
90
|
-
const escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
91
|
-
const validSearchWords = searchWords.filter((word) => isNonEmptyString(word)).map(escapeRegex);
|
|
92
|
-
if (validSearchWords.length === 0) return false;
|
|
93
|
-
return validSearchWords.every((word) => {
|
|
94
|
-
const pattern = exactMatch ? `(?<!\\S)${word}(?!\\S)` : word;
|
|
95
|
-
return new RegExp(pattern, flags.includes("u") ? flags : flags + "u").test(text);
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
var textContainsAny = (text, searchWords, options = {}) => {
|
|
100
|
-
if (!isNonEmptyString(text) || !isArray(searchWords)) {
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
assertIsPlainObject(options, {
|
|
104
|
-
message: ({ currentType, validType }) => `Third parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
105
|
-
});
|
|
106
|
-
const { exactMatch = false, flags = "i" } = options;
|
|
107
|
-
assertIsBoolean(exactMatch, {
|
|
108
|
-
message: ({ currentType, validType }) => `Parameter \`exactMatch\` property of the \`options\` (third parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
109
|
-
});
|
|
110
|
-
assertIsString(flags, {
|
|
111
|
-
message: ({ currentType, validType }) => `Parameter \`flags\` property of the \`options\` (third parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
112
|
-
});
|
|
113
|
-
const escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
114
|
-
const validSearchWords = searchWords.filter((word) => isNonEmptyString(word)).map(escapeRegex);
|
|
115
|
-
if (validSearchWords.length === 0) return false;
|
|
116
|
-
const pattern = exactMatch ? `(?<!\\S)(${validSearchWords.join("|")})(?!\\S)` : `(${validSearchWords.join("|")})`;
|
|
117
|
-
return new RegExp(pattern, flags.includes("u") ? flags : flags + "u").test(text);
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
function isPropertyKey(value) {
|
|
121
|
-
const type = typeof value;
|
|
122
|
-
return type === "string" || type === "number" || type === "symbol";
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
var doesKeyExist = (object, key) => {
|
|
126
|
-
if (!isObjectOrArray(object)) return false;
|
|
127
|
-
if (!isPropertyKey(key)) {
|
|
128
|
-
throw new TypeError(
|
|
129
|
-
`Second Parameter (\`key\`) must be of type \`string\`, \`number\` or \`symbol\`, but received: \`${getPreciseType(
|
|
130
|
-
key
|
|
131
|
-
)}\`.`
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
if (Object.prototype.hasOwnProperty.call(object, key)) return true;
|
|
135
|
-
if (isArray(object)) {
|
|
136
|
-
return object.some((item) => doesKeyExist(item, key));
|
|
137
|
-
}
|
|
138
|
-
return Object.values(object).some(
|
|
139
|
-
(value) => isObjectOrArray(value) && doesKeyExist(value, key)
|
|
140
|
-
);
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
var arrayHasAnyMatch = (sourceArray, targetArray) => {
|
|
144
|
-
if (!isArray(sourceArray) || !isArray(targetArray) || isEmptyArray(sourceArray) || isEmptyArray(targetArray)) {
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
const sourceSet = new Set(sourceArray);
|
|
148
|
-
return targetArray.some((item) => sourceSet.has(item));
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
var isArguments = (value) => {
|
|
152
|
-
return Object.prototype.toString.call(value) === "[object Arguments]";
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
function isLength(value) {
|
|
156
|
-
return typeof value === "number" && value > -1 && Number.isInteger(value) && value <= Number.MAX_SAFE_INTEGER;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function isArrayLike(value) {
|
|
160
|
-
return !isFunction(value) && isObjectOrArray(value) && isLength(value?.length);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function isArrayLikeObject(value) {
|
|
164
|
-
return isObjectOrArray(value) && isLength(value.length);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
var isCurrencyLike = (input) => {
|
|
168
|
-
if (!(isString(input) || isNumber(input))) return false;
|
|
169
|
-
const parsed = parseCurrencyString(input.toString());
|
|
170
|
-
if (parsed !== 0) return true;
|
|
171
|
-
return input.toString().trim() === "0";
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
var isDeepEqual = (a, b) => {
|
|
175
|
-
if (typeof a === "number" && typeof b === "number" && Number.isNaN(a) && Number.isNaN(b)) {
|
|
176
|
-
return true;
|
|
177
|
-
}
|
|
178
|
-
if (a === b) return true;
|
|
179
|
-
if (typeof a !== typeof b) return false;
|
|
180
|
-
if (isDate(a) && isDate(b)) {
|
|
181
|
-
return a.getTime() === b.getTime();
|
|
182
|
-
}
|
|
183
|
-
if (isRegExp(a) && isRegExp(b)) {
|
|
184
|
-
return a.toString() === b.toString();
|
|
185
|
-
}
|
|
186
|
-
if (isSymbol(a) && isSymbol(b)) {
|
|
187
|
-
return a.toString() === b.toString();
|
|
188
|
-
}
|
|
189
|
-
if (isSet(a) && isSet(b)) {
|
|
190
|
-
if (a.size !== b.size) return false;
|
|
191
|
-
const bValues = Array.from(b);
|
|
192
|
-
const matched = /* @__PURE__ */ new Set();
|
|
193
|
-
for (const aVal of a) {
|
|
194
|
-
let found = false;
|
|
195
|
-
for (let i = 0; i < bValues.length; i++) {
|
|
196
|
-
if (matched.has(i)) continue;
|
|
197
|
-
if (isDeepEqual(aVal, bValues[i])) {
|
|
198
|
-
matched.add(i);
|
|
199
|
-
found = true;
|
|
200
|
-
break;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
if (!found) return false;
|
|
204
|
-
}
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
if (isMap(a) && isMap(b)) {
|
|
208
|
-
if (a.size !== b.size) return false;
|
|
209
|
-
const bEntries = Array.from(b);
|
|
210
|
-
const matched = /* @__PURE__ */ new Set();
|
|
211
|
-
for (const [aKey, aVal] of a) {
|
|
212
|
-
let found = false;
|
|
213
|
-
for (let i = 0; i < bEntries.length; i++) {
|
|
214
|
-
if (matched.has(i)) continue;
|
|
215
|
-
const [bKey, bVal] = bEntries[i];
|
|
216
|
-
if (isDeepEqual(aKey, bKey) && isDeepEqual(aVal, bVal)) {
|
|
217
|
-
matched.add(i);
|
|
218
|
-
found = true;
|
|
219
|
-
break;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
if (!found) return false;
|
|
223
|
-
}
|
|
224
|
-
return true;
|
|
225
|
-
}
|
|
226
|
-
if (isArray(a) && isArray(b)) {
|
|
227
|
-
if (a.length !== b.length) return false;
|
|
228
|
-
return a.every((item, i) => isDeepEqual(item, b[i]));
|
|
229
|
-
}
|
|
230
|
-
if (isObjectOrArray(a) && isObjectOrArray(b) && a && b) {
|
|
231
|
-
if (isArray(a) !== isArray(b)) return false;
|
|
232
|
-
const aKeys = Object.keys(a);
|
|
233
|
-
const bKeys = Object.keys(b);
|
|
234
|
-
if (aKeys.length !== bKeys.length) return false;
|
|
235
|
-
return aKeys.every((key) => isDeepEqual(a[key], b[key]));
|
|
236
|
-
}
|
|
237
|
-
return false;
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
function isElement(value) {
|
|
241
|
-
return !!value && typeof value === "object" && value?.nodeType === 1 && !isPlainObject(value);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
function isEmpty(value) {
|
|
245
|
-
if (isNil(value)) return true;
|
|
246
|
-
if (isBoolean(value) || isNumber(value, { includeNaN: true }) || isSymbol(value))
|
|
247
|
-
return true;
|
|
248
|
-
if (isFunction(value)) {
|
|
249
|
-
return Object.keys(value).length === 0;
|
|
250
|
-
}
|
|
251
|
-
if (isString(value) || isArray(value) || isArguments(value) || isTypedArray(value)) {
|
|
252
|
-
return value.length === 0;
|
|
253
|
-
}
|
|
254
|
-
if (isMap(value) || isSet(value)) {
|
|
255
|
-
return value.size === 0;
|
|
256
|
-
}
|
|
257
|
-
if (isBuffer(value)) {
|
|
258
|
-
return value.length === 0;
|
|
259
|
-
}
|
|
260
|
-
if (isPlainObject(value)) {
|
|
261
|
-
return Object.keys(value).length === 0;
|
|
262
|
-
}
|
|
263
|
-
return false;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
var isEmptyDeep = (value) => {
|
|
267
|
-
if (isString(value)) return isEmptyString(value);
|
|
268
|
-
if (isNumber(value)) return isNaN(value);
|
|
269
|
-
if (isArray(value)) {
|
|
270
|
-
return isEmptyArray(value) || value.every(isEmptyDeep);
|
|
271
|
-
}
|
|
272
|
-
if (isObjectOrArray(value)) {
|
|
273
|
-
const keys = Object.keys(value);
|
|
274
|
-
const symbols = Object.getOwnPropertySymbols(value);
|
|
275
|
-
if (keys.length === 0 && symbols.length === 0) return true;
|
|
276
|
-
return [...keys, ...symbols].every((key) => isEmptyDeep(value[key]));
|
|
277
|
-
}
|
|
278
|
-
if (!value) return true;
|
|
279
|
-
return false;
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
function isEqualWith(value, other, customizer) {
|
|
283
|
-
return baseDeepEqual(value, other, customizer, /* @__PURE__ */ new WeakMap());
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
function isMatchWith(value, other, customizer) {
|
|
287
|
-
return baseIsMatch(value, other, customizer);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
function isSameValue(x, y) {
|
|
291
|
-
return x === y || x === 0 && y === 0 || Number.isNaN(x) && Number.isNaN(y);
|
|
292
|
-
}
|
|
293
|
-
function baseIsMatch(object, source, customizer) {
|
|
294
|
-
if (object === source) return true;
|
|
295
|
-
if (!isObjectOrArray(source)) {
|
|
296
|
-
return isSameValue(object, source);
|
|
297
|
-
}
|
|
298
|
-
if (!isObjectOrArray(object)) {
|
|
299
|
-
return false;
|
|
300
|
-
}
|
|
301
|
-
const keys = Reflect.ownKeys(source).filter(
|
|
302
|
-
(k) => !(isArray(source) && k === "length")
|
|
303
|
-
);
|
|
304
|
-
for (const key of keys) {
|
|
305
|
-
if (!(key in object)) return false;
|
|
306
|
-
const objValue = object[key];
|
|
307
|
-
const srcValue = source[key];
|
|
308
|
-
const result = customizer?.(objValue, srcValue, key, object, source);
|
|
309
|
-
if (!isUndefined(result)) {
|
|
310
|
-
if (!result) return false;
|
|
311
|
-
continue;
|
|
312
|
-
}
|
|
313
|
-
if (isObjectOrArray(objValue) && isObjectOrArray(srcValue)) {
|
|
314
|
-
if (!isMatchWith(objValue, srcValue, customizer)) return false;
|
|
315
|
-
} else {
|
|
316
|
-
if (!isSameValue(objValue, srcValue)) return false;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
return true;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
function isMatch(object, source) {
|
|
323
|
-
return baseIsMatch(object, source);
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
var funcToString = Function.prototype.toString;
|
|
327
|
-
var reIsNative = /\{\s*\[native code\]\s*\}/;
|
|
328
|
-
function isNative(value) {
|
|
329
|
-
if (!isFunction(value)) return false;
|
|
330
|
-
try {
|
|
331
|
-
const source = funcToString.call(value);
|
|
332
|
-
return reIsNative.test(source);
|
|
333
|
-
} catch {
|
|
334
|
-
return false;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
function isObjectLoose(value) {
|
|
339
|
-
return !isNil(value) && (isObjectOrArray(value) || isFunction(value));
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
function isSafeInteger(value) {
|
|
343
|
-
return typeof value === "number" && Number.isSafeInteger(value);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
var isValidURL = (url) => {
|
|
347
|
-
if (!isNonEmptyString(url)) return false;
|
|
348
|
-
let decodedUrl;
|
|
349
|
-
try {
|
|
350
|
-
decodedUrl = decodeURIComponent(url);
|
|
351
|
-
} catch {
|
|
352
|
-
return false;
|
|
353
|
-
}
|
|
354
|
-
if (!decodedUrl.startsWith("http://") && !decodedUrl.startsWith("https://")) {
|
|
355
|
-
return false;
|
|
356
|
-
}
|
|
357
|
-
const urlPattern = new RegExp(
|
|
358
|
-
/^https?:\/\/(?:localhost(?::\d+)?(?:[\/?#][^\s]*)?|(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}(?::\d+)?(?:[\/?#][^\s]*)?)$/
|
|
359
|
-
//! DEPRECATED
|
|
360
|
-
// /^https?:\/\/(?:localhost(?::\d+)?(?:[/?#][^\s]*)?|(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6})(?:[/?#][^\s]*)?$/
|
|
361
|
-
// /^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_+.~#?&/=]*)$/
|
|
362
|
-
);
|
|
363
|
-
return urlPattern.test(decodedUrl);
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
function isWeakMap(value) {
|
|
367
|
-
return isObject(value) && !isNull(value) && value instanceof WeakMap;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
export { areArraysEqual, areObjectsEqual, areURLsEqualPath, areURLsIdentical, arrayHasAnyMatch, doesKeyExist, isArguments, isArrayLike, isArrayLikeObject, isCurrencyLike, isDeepEqual, isElement, isEmpty, isEmptyDeep, isEqualWith, isLength, isMatch, isMatchWith, isNative, isObjectLoose, isPropertyKey, isSafeInteger, isValidURL, isWeakMap, textContainsAll, textContainsAny };
|
package/dist/chunk-DVMHRLKP.cjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* ====================================================
|
|
3
|
-
* Rzl Utils-JS.
|
|
4
|
-
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.11.1.
|
|
6
|
-
* Author: Rizalvin Dwiky.
|
|
7
|
-
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
|
-
* ====================================================
|
|
9
|
-
*/
|
|
10
|
-
'use strict';
|
|
11
|
-
|
|
12
|
-
function isInteger(value) {
|
|
13
|
-
return typeof value === "number" && Number.isInteger(value);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
exports.isInteger = isInteger;
|
package/dist/chunk-EBYFYZW4.cjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* ====================================================
|
|
3
|
-
* Rzl Utils-JS.
|
|
4
|
-
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.11.1.
|
|
6
|
-
* Author: Rizalvin Dwiky.
|
|
7
|
-
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
|
-
* ====================================================
|
|
9
|
-
*/
|
|
10
|
-
'use strict';
|
|
11
|
-
|
|
12
|
-
var chunkSYHPSOUU_cjs = require('./chunk-SYHPSOUU.cjs');
|
|
13
|
-
|
|
14
|
-
var removeSpaces = (value, options = {
|
|
15
|
-
trimOnly: false
|
|
16
|
-
}) => {
|
|
17
|
-
if (!chunkSYHPSOUU_cjs.isNonEmptyString(value)) return "";
|
|
18
|
-
if (!chunkSYHPSOUU_cjs.isPlainObject(options)) {
|
|
19
|
-
options = {};
|
|
20
|
-
}
|
|
21
|
-
const { trimOnly = false } = options;
|
|
22
|
-
if (trimOnly) return value.trim();
|
|
23
|
-
return value.replace(/\s+/g, "");
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
exports.removeSpaces = removeSpaces;
|