@rzl-zone/utils-js 3.12.0 → 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 -214
- 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 -212
- 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-2AFQ33D3.cjs +0 -64
- package/dist/chunk-2CYDJVGM.js +0 -246
- package/dist/chunk-2MW4JDQ2.cjs +0 -598
- package/dist/chunk-2VTDXC3N.cjs +0 -1825
- package/dist/chunk-44XX2P34.js +0 -209
- package/dist/chunk-4YLBKLGS.cjs +0 -18
- package/dist/chunk-566CXQW7.cjs +0 -560
- package/dist/chunk-57EPKYID.cjs +0 -397
- package/dist/chunk-5MGEC3YG.js +0 -63
- package/dist/chunk-6EF52423.cjs +0 -249
- package/dist/chunk-6SCOKU3S.js +0 -109
- package/dist/chunk-6VUXD3CF.js +0 -119
- package/dist/chunk-7B76BSNK.cjs +0 -118
- package/dist/chunk-7Y6I2DSU.cjs +0 -101
- package/dist/chunk-A7S7E2EE.cjs +0 -308
- package/dist/chunk-AJZ6PMMZ.js +0 -16
- package/dist/chunk-AXGBL2IO.cjs +0 -251
- package/dist/chunk-B4TC6FBV.cjs +0 -678
- package/dist/chunk-BAV5T2E3.cjs +0 -15
- package/dist/chunk-BKIJBNIE.js +0 -21
- package/dist/chunk-BNIMTFK5.js +0 -59
- package/dist/chunk-BXW7YXB7.js +0 -1823
- package/dist/chunk-CFYZC4S6.js +0 -53
- package/dist/chunk-CSG4SCL3.js +0 -1587
- package/dist/chunk-CWQW7AKK.js +0 -676
- package/dist/chunk-DVMHRLKP.cjs +0 -16
- package/dist/chunk-EN7LVZBZ.js +0 -548
- package/dist/chunk-EV4Y7HCY.cjs +0 -26
- package/dist/chunk-F66VDYIZ.cjs +0 -18
- package/dist/chunk-FLJX37EL.cjs +0 -30
- package/dist/chunk-GKC3UDMC.cjs +0 -1623
- package/dist/chunk-H65I3GRZ.cjs +0 -106
- package/dist/chunk-HHYWB7VZ.js +0 -24
- package/dist/chunk-HNGGISFL.cjs +0 -65
- package/dist/chunk-HNSQAVSZ.cjs +0 -35
- package/dist/chunk-HSP6IWZK.js +0 -17
- package/dist/chunk-IDZS7J6T.js +0 -242
- package/dist/chunk-JS6R55VL.js +0 -302
- package/dist/chunk-JZVT5FK7.js +0 -232
- package/dist/chunk-KHO2SBNA.cjs +0 -16
- package/dist/chunk-KIDJCMNJ.js +0 -33
- package/dist/chunk-KOLEURVT.cjs +0 -38
- package/dist/chunk-L4V53MQK.cjs +0 -269
- package/dist/chunk-L5RDAVVH.js +0 -14
- package/dist/chunk-NODTV4F3.js +0 -16
- package/dist/chunk-NYK5K3V2.cjs +0 -211
- package/dist/chunk-ODUO3RTL.cjs +0 -113
- package/dist/chunk-ONZFBJVW.js +0 -14
- package/dist/chunk-PFXCTE37.js +0 -28
- package/dist/chunk-PPST7QAQ.js +0 -587
- package/dist/chunk-Q5IMYDFL.cjs +0 -33
- package/dist/chunk-QFFBIOJ4.js +0 -31
- package/dist/chunk-QNKGP5DY.js +0 -14
- package/dist/chunk-RRQHMOPE.cjs +0 -19
- package/dist/chunk-RU5OSRBU.js +0 -95
- package/dist/chunk-SDMPEJ4F.js +0 -35
- package/dist/chunk-SYNL5IKP.js +0 -115
- package/dist/chunk-TCDOWZQE.js +0 -16
- package/dist/chunk-TQPGXGKB.cjs +0 -123
- package/dist/chunk-TULOI4GL.js +0 -370
- package/dist/chunk-UBHCP4N5.cjs +0 -36
- package/dist/chunk-UCHF3M34.cjs +0 -56
- package/dist/chunk-UDA26MCU.cjs +0 -16
- package/dist/chunk-V3C4FYZL.cjs +0 -18
- package/dist/chunk-VAAHZFBF.js +0 -32
- package/dist/chunk-VJDDGRIK.cjs +0 -16
- package/dist/chunk-WVSPXFTY.js +0 -14
- package/dist/chunk-WYP76WXB.js +0 -101
- package/dist/chunk-YDE4ZBB7.cjs +0 -237
- package/dist/chunk-YKQEOO7C.cjs +0 -23
- package/dist/chunk-YSZC56SZ.js +0 -264
- package/dist/chunk-YWHHVDT4.js +0 -13
- package/dist/index.d.ts +0 -24
- package/dist/isPlainObject-DTJVV2Kf.d.ts +0 -536
- package/dist/rzl-utils.global.js +0 -10
package/dist/chunk-6EF52423.cjs
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* ====================================================
|
|
3
|
-
* Rzl Utils-JS.
|
|
4
|
-
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.12.0.
|
|
6
|
-
* Author: Rizalvin Dwiky.
|
|
7
|
-
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
|
-
* ====================================================
|
|
9
|
-
*/
|
|
10
|
-
'use strict';
|
|
11
|
-
|
|
12
|
-
var chunk2VTDXC3N_cjs = require('./chunk-2VTDXC3N.cjs');
|
|
13
|
-
var chunkEV4Y7HCY_cjs = require('./chunk-EV4Y7HCY.cjs');
|
|
14
|
-
var chunk4YLBKLGS_cjs = require('./chunk-4YLBKLGS.cjs');
|
|
15
|
-
var chunkTQPGXGKB_cjs = require('./chunk-TQPGXGKB.cjs');
|
|
16
|
-
var chunkGKC3UDMC_cjs = require('./chunk-GKC3UDMC.cjs');
|
|
17
|
-
|
|
18
|
-
var NormalizePathnameError = class _NormalizePathnameError extends Error {
|
|
19
|
-
/** * ***The original error that triggered this normalization failure.***
|
|
20
|
-
*
|
|
21
|
-
* **Always available for backward compatibility.**
|
|
22
|
-
*/
|
|
23
|
-
originalError;
|
|
24
|
-
constructor(message, originalError) {
|
|
25
|
-
super(message, chunkGKC3UDMC_cjs.isFunction(Error) ? { cause: originalError } : void 0);
|
|
26
|
-
this.name = "NormalizePathnameError";
|
|
27
|
-
this.originalError = originalError;
|
|
28
|
-
if (chunkGKC3UDMC_cjs.isFunction(Error.captureStackTrace)) {
|
|
29
|
-
Error.captureStackTrace(this, _NormalizePathnameError);
|
|
30
|
-
} else {
|
|
31
|
-
this.stack = new Error(message).stack;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/** * ***Safe JSON representation for logging or IPC.*** */
|
|
35
|
-
toJSON() {
|
|
36
|
-
return {
|
|
37
|
-
name: this.name,
|
|
38
|
-
message: this.message,
|
|
39
|
-
stack: this.stack,
|
|
40
|
-
originalError: {
|
|
41
|
-
name: this.originalError.name,
|
|
42
|
-
message: this.originalError.message,
|
|
43
|
-
stack: this.originalError.stack
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
function normalizePathname(pathname, options = {
|
|
50
|
-
defaultPath: "/",
|
|
51
|
-
keepNullable: false
|
|
52
|
-
}) {
|
|
53
|
-
chunkGKC3UDMC_cjs.assertIsPlainObject(options, {
|
|
54
|
-
message({ currentType, validType }) {
|
|
55
|
-
return `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
const {
|
|
59
|
-
defaultPath = "/",
|
|
60
|
-
keepNullable = false,
|
|
61
|
-
keepTrailingSlash = false,
|
|
62
|
-
localhostDomain = false,
|
|
63
|
-
ignoreDomainExtensions = void 0
|
|
64
|
-
} = options;
|
|
65
|
-
if (!chunkGKC3UDMC_cjs.isNonEmptyString(defaultPath)) {
|
|
66
|
-
throw new TypeError(
|
|
67
|
-
`Parameter \`defaultPath\` property of the \`options\` (second parameter) must be of type \`string\` and not empty-string, but received: \`${chunkGKC3UDMC_cjs.getPreciseType(
|
|
68
|
-
defaultPath
|
|
69
|
-
)}\`, with value: \`${chunkTQPGXGKB_cjs.safeStableStringify(defaultPath, {
|
|
70
|
-
keepUndefined: true
|
|
71
|
-
})}\`.`
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
chunkGKC3UDMC_cjs.assertIsBoolean(keepNullable, {
|
|
75
|
-
message({ currentType, validType }) {
|
|
76
|
-
return `Parameter \`keepNullable\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
chunkGKC3UDMC_cjs.assertIsBoolean(keepTrailingSlash, {
|
|
80
|
-
message({ currentType, validType }) {
|
|
81
|
-
return `Parameter \`keepTrailingSlash\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
chunkGKC3UDMC_cjs.assertIsBoolean(localhostDomain, {
|
|
85
|
-
message({ currentType, validType }) {
|
|
86
|
-
return `Parameter \`localhostDomain\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
let ignoreDomainExtsSet;
|
|
90
|
-
if (!chunkGKC3UDMC_cjs.isUndefined(ignoreDomainExtensions)) {
|
|
91
|
-
if (!chunkGKC3UDMC_cjs.isSet(ignoreDomainExtensions) && !chunkGKC3UDMC_cjs.isArray(ignoreDomainExtensions)) {
|
|
92
|
-
throw new TypeError(
|
|
93
|
-
`Parameter \`ignoreDomainExtensions\` must be of type a \`Set<string>\` or \`string[]\`, but received: \`${chunkGKC3UDMC_cjs.getPreciseType(
|
|
94
|
-
ignoreDomainExtensions
|
|
95
|
-
)}\`.`
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
ignoreDomainExtsSet = chunkGKC3UDMC_cjs.isSet(ignoreDomainExtensions) ? ignoreDomainExtensions : new Set(ignoreDomainExtensions);
|
|
99
|
-
let idx = 0;
|
|
100
|
-
for (const ext of ignoreDomainExtsSet) {
|
|
101
|
-
if (!chunkGKC3UDMC_cjs.isNonEmptyString(ext)) {
|
|
102
|
-
throw new TypeError(
|
|
103
|
-
`Parameter \`ignoreDomainExtensions[${idx}]\` must be a \`string\` and \`non-empty string\`, but received: \`${chunkTQPGXGKB_cjs.safeStableStringify(
|
|
104
|
-
ext,
|
|
105
|
-
{ keepUndefined: true }
|
|
106
|
-
)}\`.`
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
if (!ext.startsWith(".")) {
|
|
110
|
-
throw new TypeError(
|
|
111
|
-
`Parameter \`ignoreDomainExtensions[${idx}]\` must start with a dot (.), but received: ${chunkTQPGXGKB_cjs.safeStableStringify(
|
|
112
|
-
ext,
|
|
113
|
-
{ keepUndefined: true }
|
|
114
|
-
)}`
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
idx++;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
try {
|
|
121
|
-
if (keepNullable && (chunkGKC3UDMC_cjs.isNil(pathname) || !chunkGKC3UDMC_cjs.isString(pathname))) {
|
|
122
|
-
if (chunkGKC3UDMC_cjs.isNull(pathname)) return null;
|
|
123
|
-
return void 0;
|
|
124
|
-
}
|
|
125
|
-
let currentPathName = chunkGKC3UDMC_cjs.isNonEmptyString(pathname) ? pathname : defaultPath;
|
|
126
|
-
currentPathName = chunkEV4Y7HCY_cjs.removeSpaces(currentPathName, { trimOnly: true }).replace(
|
|
127
|
-
/\s+/g,
|
|
128
|
-
""
|
|
129
|
-
);
|
|
130
|
-
currentPathName = stripLeadingDomain(currentPathName, {
|
|
131
|
-
keepTrailingSlash,
|
|
132
|
-
localhostDomain,
|
|
133
|
-
ignoreDomainExtensions: ignoreDomainExtsSet
|
|
134
|
-
});
|
|
135
|
-
let _pathName = currentPathName;
|
|
136
|
-
let search = "";
|
|
137
|
-
let hash = "";
|
|
138
|
-
const searchIndex = currentPathName.indexOf("?");
|
|
139
|
-
const hashIndex = currentPathName.indexOf("#");
|
|
140
|
-
if (searchIndex !== -1) {
|
|
141
|
-
search = currentPathName.slice(
|
|
142
|
-
searchIndex,
|
|
143
|
-
hashIndex !== -1 ? hashIndex : void 0
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
if (hashIndex !== -1) {
|
|
147
|
-
hash = currentPathName.slice(hashIndex);
|
|
148
|
-
}
|
|
149
|
-
const endIndex = Math.min(
|
|
150
|
-
searchIndex !== -1 ? searchIndex : currentPathName.length,
|
|
151
|
-
hashIndex !== -1 ? hashIndex : currentPathName.length
|
|
152
|
-
);
|
|
153
|
-
_pathName = currentPathName.slice(0, endIndex);
|
|
154
|
-
_pathName = "/" + _pathName.replace(/^\/+/, "").replace(/\/{2,}/g, "/");
|
|
155
|
-
if (!keepTrailingSlash && _pathName !== "/") {
|
|
156
|
-
_pathName = _pathName.replace(/\/+$/, "");
|
|
157
|
-
}
|
|
158
|
-
_pathName = decodeUnicodeSequences(_pathName);
|
|
159
|
-
search = decodeUnicodeSequences(search);
|
|
160
|
-
hash = decodeUnicodeSequences(hash);
|
|
161
|
-
return _pathName + search + hash;
|
|
162
|
-
} catch (error) {
|
|
163
|
-
throwError(error);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
var decodeUnicodeSequences = (str) => {
|
|
167
|
-
return str.replace(/(?:%(?:[0-9A-F]{2})){2,}/gi, (match) => {
|
|
168
|
-
try {
|
|
169
|
-
const decoded = decodeURIComponent(match);
|
|
170
|
-
if (/^[\u0000-\u007F]+$/.test(decoded)) return match;
|
|
171
|
-
return decoded;
|
|
172
|
-
} catch {
|
|
173
|
-
return match;
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
};
|
|
177
|
-
var stripLeadingDomain = (path, options) => {
|
|
178
|
-
let currentPath = path;
|
|
179
|
-
const { ignoreDomainExtensions, localhostDomain } = options;
|
|
180
|
-
if (/^https?:\/\//i.test(currentPath)) {
|
|
181
|
-
try {
|
|
182
|
-
const url = new URL(currentPath);
|
|
183
|
-
currentPath = url.pathname.replace(/^\/+/, "").replace(/\/{2,}/g, "/") + url.search + url.hash;
|
|
184
|
-
return ensureLeadingSlash(currentPath);
|
|
185
|
-
} catch (error) {
|
|
186
|
-
throwError(error);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
if (currentPath.startsWith("/")) {
|
|
190
|
-
currentPath = currentPath.replace(/\/{2,}/g, "/").slice(1);
|
|
191
|
-
}
|
|
192
|
-
const segments = currentPath.split("/");
|
|
193
|
-
const firstPart = segments[0];
|
|
194
|
-
const domainPart = firstPart.split(":")[0];
|
|
195
|
-
const isDomain = chunk2VTDXC3N_cjs.isValidDomain(domainPart, {
|
|
196
|
-
subdomain: true,
|
|
197
|
-
allowUnicode: true,
|
|
198
|
-
wildcard: true,
|
|
199
|
-
allowLocalhost: localhostDomain,
|
|
200
|
-
allowPort: true,
|
|
201
|
-
allowProtocol: true,
|
|
202
|
-
topLevel: false
|
|
203
|
-
});
|
|
204
|
-
let hasIgnoredExtension = false;
|
|
205
|
-
if (ignoreDomainExtensions) {
|
|
206
|
-
for (const ext of ignoreDomainExtensions) {
|
|
207
|
-
if (firstPart.endsWith(ext)) {
|
|
208
|
-
hasIgnoredExtension = true;
|
|
209
|
-
break;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
if (isDomain && !hasIgnoredExtension) {
|
|
214
|
-
segments.shift();
|
|
215
|
-
}
|
|
216
|
-
return ensureLeadingSlash(segments.join("/"));
|
|
217
|
-
};
|
|
218
|
-
var ensureLeadingSlash = (path) => {
|
|
219
|
-
if (!path.startsWith("/")) path = "/" + path;
|
|
220
|
-
return path;
|
|
221
|
-
};
|
|
222
|
-
var throwError = (error) => {
|
|
223
|
-
const err = chunkGKC3UDMC_cjs.isError(error) ? error : new Error("Unknown error from function `normalizePathname()`.");
|
|
224
|
-
throw new NormalizePathnameError(
|
|
225
|
-
`Failed to normalize pathname in function \`normalizePathname()\`: ${err.message}`,
|
|
226
|
-
err
|
|
227
|
-
);
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
var formatEnvPort = (envVar, options = {}) => {
|
|
231
|
-
if (!chunkGKC3UDMC_cjs.isNonEmptyString(envVar)) return "";
|
|
232
|
-
chunkGKC3UDMC_cjs.assertIsPlainObject(options, {
|
|
233
|
-
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
234
|
-
});
|
|
235
|
-
const prefixColon = chunkGKC3UDMC_cjs.hasOwnProp(options, "prefixColon") ? options.prefixColon : false;
|
|
236
|
-
if (!chunkGKC3UDMC_cjs.isBoolean(prefixColon)) {
|
|
237
|
-
throw new TypeError(
|
|
238
|
-
`Parameter \`prefixColon\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: \`${chunkGKC3UDMC_cjs.getPreciseType(
|
|
239
|
-
prefixColon
|
|
240
|
-
)}\`.`
|
|
241
|
-
);
|
|
242
|
-
}
|
|
243
|
-
const digitsOnly = envVar.replace(/\D+/g, "");
|
|
244
|
-
if (chunk4YLBKLGS_cjs.isEmptyString(digitsOnly)) return "";
|
|
245
|
-
return prefixColon ? `:${digitsOnly}` : digitsOnly;
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
exports.formatEnvPort = formatEnvPort;
|
|
249
|
-
exports.normalizePathname = normalizePathname;
|
package/dist/chunk-6SCOKU3S.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* ====================================================
|
|
3
|
-
* Rzl Utils-JS.
|
|
4
|
-
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.12.0.
|
|
6
|
-
* Author: Rizalvin Dwiky.
|
|
7
|
-
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
|
-
* ====================================================
|
|
9
|
-
*/
|
|
10
|
-
import { safeJsonParse } from './chunk-YSZC56SZ.js';
|
|
11
|
-
import { isEqual } from './chunk-WYP76WXB.js';
|
|
12
|
-
import { isEmptyArray } from './chunk-SDMPEJ4F.js';
|
|
13
|
-
import { assertIsArray } from './chunk-HSP6IWZK.js';
|
|
14
|
-
import { safeStableStringify } from './chunk-6VUXD3CF.js';
|
|
15
|
-
import { isPlainObject, isNonEmptyArray, isObjectOrArray, isArray, isNaN, isUndefined } from './chunk-CSG4SCL3.js';
|
|
16
|
-
|
|
17
|
-
var findDuplicates = (values) => {
|
|
18
|
-
assertIsArray(values, {
|
|
19
|
-
message: ({ currentType, validType }) => `First parameter (\`values\`) must be of type \`${validType}\` (array literal or instance), but received: \`${currentType}\`.`
|
|
20
|
-
});
|
|
21
|
-
const duplicates = [];
|
|
22
|
-
values.forEach((item, index) => {
|
|
23
|
-
for (let i = index + 1; i < values.length; i++) {
|
|
24
|
-
if (isEqual(item, values[i])) {
|
|
25
|
-
if (!duplicates.some((dup) => isEqual(dup, item))) {
|
|
26
|
-
duplicates.push(item);
|
|
27
|
-
}
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
return duplicates;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
var omitKeys = (object, keysToOmit) => {
|
|
36
|
-
if (!isPlainObject(object)) return {};
|
|
37
|
-
assertIsArray(keysToOmit, {
|
|
38
|
-
message: ({ currentType, validType }) => `Second parameter (\`keysToOmit\`) must be of type \`${validType}\` (array literal or instance), but received: \`${currentType}\`.`
|
|
39
|
-
});
|
|
40
|
-
const duplicates = findDuplicates(keysToOmit);
|
|
41
|
-
if (duplicates.length > 0) {
|
|
42
|
-
throw new Error(
|
|
43
|
-
`Function "omitKeys" Error: Duplicate keys detected - \`${duplicates}\``
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
return Object.fromEntries(
|
|
47
|
-
Object.entries(object).filter(([key]) => !keysToOmit.includes(key))
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
var omitKeysDeep = (object, keysToOmit) => {
|
|
52
|
-
if (!isPlainObject(object)) return {};
|
|
53
|
-
assertIsArray(keysToOmit, {
|
|
54
|
-
message: ({ currentType, validType }) => `Second parameter (\`keysToOmit\`) must be of type \`${validType}\` (array literal or instance), but received: \`${currentType}\`.`
|
|
55
|
-
});
|
|
56
|
-
const duplicates = findDuplicates(keysToOmit);
|
|
57
|
-
if (isNonEmptyArray(duplicates)) {
|
|
58
|
-
throw new Error(
|
|
59
|
-
`Function "omitKeysDeep" Error: Duplicate keys detected - \`${safeStableStringify(
|
|
60
|
-
duplicates,
|
|
61
|
-
{
|
|
62
|
-
keepUndefined: true
|
|
63
|
-
}
|
|
64
|
-
)}\`.`
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
const omitAtPath = (obj, pathParts) => {
|
|
68
|
-
if (!isObjectOrArray(obj)) return obj;
|
|
69
|
-
const [current, ...rest] = pathParts;
|
|
70
|
-
if (isEmptyArray(rest)) {
|
|
71
|
-
if (isArray(obj)) {
|
|
72
|
-
const index = parseInt(current);
|
|
73
|
-
if (!isNaN(index) && index in obj) {
|
|
74
|
-
obj.splice(index, 1);
|
|
75
|
-
}
|
|
76
|
-
} else {
|
|
77
|
-
delete obj[current];
|
|
78
|
-
}
|
|
79
|
-
} else {
|
|
80
|
-
const next = obj[current];
|
|
81
|
-
if (isObjectOrArray(next)) {
|
|
82
|
-
obj[current] = omitAtPath(next, rest);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return obj;
|
|
86
|
-
};
|
|
87
|
-
const deepRemoveEmptyObjects = (obj) => {
|
|
88
|
-
if (isArray(obj)) {
|
|
89
|
-
return obj.map(deepRemoveEmptyObjects).filter((item) => !(isObjectOrArray(item) && Object.keys(item).length === 0));
|
|
90
|
-
}
|
|
91
|
-
if (isObjectOrArray(obj)) {
|
|
92
|
-
const cleaned = Object.fromEntries(
|
|
93
|
-
Object.entries(obj).map(([k, v]) => [k, deepRemoveEmptyObjects(v)]).filter(
|
|
94
|
-
([, v]) => !isUndefined(v) && !(isObjectOrArray(v) && Object.keys(v).length === 0)
|
|
95
|
-
)
|
|
96
|
-
);
|
|
97
|
-
return cleaned;
|
|
98
|
-
}
|
|
99
|
-
return obj;
|
|
100
|
-
};
|
|
101
|
-
const result = safeJsonParse(safeStableStringify(object));
|
|
102
|
-
for (const key of keysToOmit) {
|
|
103
|
-
const parts = key.split(".");
|
|
104
|
-
omitAtPath(result, parts);
|
|
105
|
-
}
|
|
106
|
-
return deepRemoveEmptyObjects(result);
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
export { findDuplicates, omitKeys, omitKeysDeep };
|
package/dist/chunk-6VUXD3CF.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* ====================================================
|
|
3
|
-
* Rzl Utils-JS.
|
|
4
|
-
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.12.0.
|
|
6
|
-
* Author: Rizalvin Dwiky.
|
|
7
|
-
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
|
-
* ====================================================
|
|
9
|
-
*/
|
|
10
|
-
import { isBigInt } from './chunk-QNKGP5DY.js';
|
|
11
|
-
import { assertIsPlainObject, isPlainObject, isBoolean, isNaN, hasOwnProp, getPreciseType, isUndefined, isNumberObject, isInfinityNumber, isStringObject, isBooleanObject, isFunction, isSymbol, isObjectOrArray, isSet, isArray, isNumber, isObject, isNull } from './chunk-CSG4SCL3.js';
|
|
12
|
-
|
|
13
|
-
function isMap(value) {
|
|
14
|
-
return Object.prototype.toString.call(value) === "[object Map]" || value instanceof Map;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
var isDate = (value, options = {}) => {
|
|
18
|
-
assertIsPlainObject(options, {
|
|
19
|
-
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
20
|
-
});
|
|
21
|
-
const skipInvalidDate = isPlainObject(options) && isBoolean(options.skipInvalidDate) ? options.skipInvalidDate : false;
|
|
22
|
-
const instanceDate = value instanceof Date;
|
|
23
|
-
if (skipInvalidDate) return instanceDate;
|
|
24
|
-
return instanceDate && !isNaN(value.getTime());
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
var safeStableStringify = (value, options = {}) => {
|
|
28
|
-
assertIsPlainObject(options, {
|
|
29
|
-
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
30
|
-
});
|
|
31
|
-
const pretty = hasOwnProp(options, "pretty") ? options.pretty : false;
|
|
32
|
-
const sortKeys = hasOwnProp(options, "sortKeys") ? options.sortKeys : true;
|
|
33
|
-
const sortArray = hasOwnProp(options, "sortArray") ? options.sortArray : false;
|
|
34
|
-
const keepUndefined = hasOwnProp(options, "keepUndefined") ? options.keepUndefined : false;
|
|
35
|
-
if (!isBoolean(sortKeys) || !isBoolean(sortArray) || !isBoolean(pretty) || !isBoolean(keepUndefined)) {
|
|
36
|
-
throw new TypeError(
|
|
37
|
-
`Parameters \`sortKeys\`, \`sortArray\`, \`keepUndefined\` and \`pretty\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: "['sortKeys': \`${getPreciseType(
|
|
38
|
-
sortKeys
|
|
39
|
-
)}\`, 'sortArray': \`${getPreciseType(
|
|
40
|
-
sortArray
|
|
41
|
-
)}\`, 'keepUndefined': \`${getPreciseType(
|
|
42
|
-
keepUndefined
|
|
43
|
-
)}\`, 'pretty': \`${getPreciseType(pretty)}\`]".`
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
if (isUndefined(value)) {
|
|
47
|
-
return keepUndefined ? "undefined" : "null";
|
|
48
|
-
}
|
|
49
|
-
const seen = /* @__PURE__ */ new WeakSet();
|
|
50
|
-
const isPrimitive = (val) => isNull(val) || !isObjectOrArray(val) && !isFunction(val);
|
|
51
|
-
const deepProcess = (val) => {
|
|
52
|
-
if (isNumberObject(val)) {
|
|
53
|
-
const valOf = val.valueOf();
|
|
54
|
-
return isNaN(valOf) || isInfinityNumber(valOf) ? null : valOf;
|
|
55
|
-
}
|
|
56
|
-
if (isStringObject(val)) return val.valueOf();
|
|
57
|
-
if (isBooleanObject(val)) return val.valueOf();
|
|
58
|
-
if (isFunction(val) || isSymbol(val)) return void 0;
|
|
59
|
-
if (isBigInt(val)) return val.toString();
|
|
60
|
-
if (isNaN(val) || isInfinityNumber(val)) return null;
|
|
61
|
-
if (isUndefined(val)) {
|
|
62
|
-
return keepUndefined ? void 0 : null;
|
|
63
|
-
}
|
|
64
|
-
if (isObjectOrArray(val)) {
|
|
65
|
-
if (seen.has(val)) return "[Circular]";
|
|
66
|
-
seen.add(val);
|
|
67
|
-
if (isDate(val)) return val.toISOString();
|
|
68
|
-
if (isMap(val)) {
|
|
69
|
-
return {
|
|
70
|
-
map: Array.from(val.entries()).map(([k, v]) => [k, deepProcess(v)])
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
if (isSet(val)) return { set: Array.from(val.values()).map(deepProcess) };
|
|
74
|
-
if (isArray(val)) {
|
|
75
|
-
const processedArr = val.map(deepProcess);
|
|
76
|
-
if (sortArray) {
|
|
77
|
-
const primitives = [];
|
|
78
|
-
const nonPrimitives = [];
|
|
79
|
-
for (const item of processedArr) {
|
|
80
|
-
if (isPrimitive(item)) primitives.push(item);
|
|
81
|
-
else nonPrimitives.push(item);
|
|
82
|
-
}
|
|
83
|
-
primitives.sort((a, b) => {
|
|
84
|
-
if (isNumber(a) && isNumber(b)) return a - b;
|
|
85
|
-
return String(a).localeCompare(String(b));
|
|
86
|
-
});
|
|
87
|
-
return [...primitives, ...nonPrimitives];
|
|
88
|
-
}
|
|
89
|
-
return processedArr;
|
|
90
|
-
}
|
|
91
|
-
const keys = Object.keys(val);
|
|
92
|
-
if (sortKeys) {
|
|
93
|
-
keys.sort((a, b) => {
|
|
94
|
-
const na = Number(a);
|
|
95
|
-
const nb = Number(b);
|
|
96
|
-
if (!isNaN(na) && !isNaN(nb)) return na - nb;
|
|
97
|
-
return a.localeCompare(b);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
const result = {};
|
|
101
|
-
if (isObject(val)) {
|
|
102
|
-
for (const k of keys) {
|
|
103
|
-
const v = deepProcess(val[k]);
|
|
104
|
-
if (!isUndefined(v)) result[k] = v;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return result;
|
|
108
|
-
}
|
|
109
|
-
return val;
|
|
110
|
-
};
|
|
111
|
-
try {
|
|
112
|
-
return JSON.stringify(deepProcess(value), null, pretty ? 2 : 0);
|
|
113
|
-
} catch (err) {
|
|
114
|
-
console.warn("Error in safeStableStringify:", err);
|
|
115
|
-
return "{}";
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
export { isDate, isMap, safeStableStringify };
|
package/dist/chunk-7B76BSNK.cjs
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* ====================================================
|
|
3
|
-
* Rzl Utils-JS.
|
|
4
|
-
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.12.0.
|
|
6
|
-
* Author: Rizalvin Dwiky.
|
|
7
|
-
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
|
-
* ====================================================
|
|
9
|
-
*/
|
|
10
|
-
'use strict';
|
|
11
|
-
|
|
12
|
-
var chunkDVMHRLKP_cjs = require('./chunk-DVMHRLKP.cjs');
|
|
13
|
-
var chunkTQPGXGKB_cjs = require('./chunk-TQPGXGKB.cjs');
|
|
14
|
-
var chunkGKC3UDMC_cjs = require('./chunk-GKC3UDMC.cjs');
|
|
15
|
-
|
|
16
|
-
var CustomPromise = class extends Promise {
|
|
17
|
-
_value;
|
|
18
|
-
_error;
|
|
19
|
-
_finish = [];
|
|
20
|
-
constructor(executor) {
|
|
21
|
-
let resolveOuter;
|
|
22
|
-
let rejectOuter;
|
|
23
|
-
super((resolve, reject) => {
|
|
24
|
-
resolveOuter = resolve;
|
|
25
|
-
rejectOuter = reject;
|
|
26
|
-
});
|
|
27
|
-
executor(
|
|
28
|
-
(v) => {
|
|
29
|
-
this._value = v;
|
|
30
|
-
resolveOuter(v);
|
|
31
|
-
this._finish.forEach((f) => f(v, void 0));
|
|
32
|
-
},
|
|
33
|
-
(e) => {
|
|
34
|
-
this._error = e;
|
|
35
|
-
rejectOuter(e);
|
|
36
|
-
this._finish.forEach((f) => f(void 0, e));
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
40
|
-
}
|
|
41
|
-
then(onfulfilled, onrejected) {
|
|
42
|
-
return super.then(onfulfilled, onrejected);
|
|
43
|
-
}
|
|
44
|
-
catch(onrejected) {
|
|
45
|
-
return super.catch(onrejected);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Registers a callback to be invoked **exactly once** when the
|
|
49
|
-
* promise settles, with access to both the resolved value and
|
|
50
|
-
* the rejection reason.
|
|
51
|
-
*
|
|
52
|
-
* If the promise is already settled when `finish` is called,
|
|
53
|
-
* the callback executes immediately on the same tick.
|
|
54
|
-
*
|
|
55
|
-
* @param cb Callback receiving the final `(value, error)`.
|
|
56
|
-
* @returns `this` for fluent chaining.
|
|
57
|
-
*/
|
|
58
|
-
finish(cb) {
|
|
59
|
-
if (this._value !== void 0 || this._error !== void 0) {
|
|
60
|
-
cb(this._value, this._error);
|
|
61
|
-
} else {
|
|
62
|
-
this._finish.push(cb);
|
|
63
|
-
}
|
|
64
|
-
return this;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
var AbortError = class extends Error {
|
|
69
|
-
constructor(message = "The operation was aborted", name = "AbortError") {
|
|
70
|
-
super(message);
|
|
71
|
-
this.name = name;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
var delay = (milliSeconds = 1e3, signal) => {
|
|
75
|
-
if (!chunkDVMHRLKP_cjs.isInteger(milliSeconds) || milliSeconds <= 0) {
|
|
76
|
-
throw new TypeError(
|
|
77
|
-
`First parameter (\`milliSeconds\`) must be of type \`number\` and value must be a \`non-zero\`, \`non-NaN\`, \`non-negative\`, and \`integer-number\`, but received: \`${chunkGKC3UDMC_cjs.getPreciseType(
|
|
78
|
-
milliSeconds
|
|
79
|
-
)}\`, with value: \`${chunkTQPGXGKB_cjs.safeStableStringify(milliSeconds, {
|
|
80
|
-
keepUndefined: true
|
|
81
|
-
})}\`.`
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
if (chunkGKC3UDMC_cjs.isNull(signal) || signal && !(signal instanceof AbortSignal)) {
|
|
85
|
-
throw new TypeError(
|
|
86
|
-
"Second parameter (`signal`) must be an `instance of AbortSignal` if provided."
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
return new Promise((resolve, reject) => {
|
|
90
|
-
const timer = setTimeout(() => {
|
|
91
|
-
cleanup();
|
|
92
|
-
resolve();
|
|
93
|
-
}, milliSeconds);
|
|
94
|
-
const cleanup = () => {
|
|
95
|
-
clearTimeout(timer);
|
|
96
|
-
if (signal) signal.removeEventListener("abort", onAbort);
|
|
97
|
-
};
|
|
98
|
-
const onAbort = () => {
|
|
99
|
-
cleanup();
|
|
100
|
-
reject(
|
|
101
|
-
new AbortError(
|
|
102
|
-
"Function `delay` from `@rzl-zone/utils-js` was aborted.",
|
|
103
|
-
"AbortError"
|
|
104
|
-
)
|
|
105
|
-
);
|
|
106
|
-
};
|
|
107
|
-
if (signal) {
|
|
108
|
-
if (signal.aborted) {
|
|
109
|
-
onAbort();
|
|
110
|
-
} else {
|
|
111
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
exports.CustomPromise = CustomPromise;
|
|
118
|
-
exports.delay = delay;
|
package/dist/chunk-7Y6I2DSU.cjs
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* ====================================================
|
|
3
|
-
* Rzl Utils-JS.
|
|
4
|
-
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.12.0.
|
|
6
|
-
* Author: Rizalvin Dwiky.
|
|
7
|
-
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
|
-
* ====================================================
|
|
9
|
-
*/
|
|
10
|
-
'use strict';
|
|
11
|
-
|
|
12
|
-
var chunk4YLBKLGS_cjs = require('./chunk-4YLBKLGS.cjs');
|
|
13
|
-
var chunkGKC3UDMC_cjs = require('./chunk-GKC3UDMC.cjs');
|
|
14
|
-
|
|
15
|
-
var capitalizeFirst = (string, options = {
|
|
16
|
-
lowerCaseNextRest: true,
|
|
17
|
-
trim: false
|
|
18
|
-
}) => {
|
|
19
|
-
if (!chunkGKC3UDMC_cjs.isNonEmptyString(string)) return "";
|
|
20
|
-
if (!chunkGKC3UDMC_cjs.isPlainObject(options)) {
|
|
21
|
-
options = {};
|
|
22
|
-
}
|
|
23
|
-
const lowerCaseNextRest = options.lowerCaseNextRest !== false;
|
|
24
|
-
const trim = options.trim === true;
|
|
25
|
-
if (trim) string = string.trim();
|
|
26
|
-
return string[0].toUpperCase() + (lowerCaseNextRest ? string.slice(1).toLowerCase() : string.slice(1));
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
var capitalizeWords = (value, options = {
|
|
30
|
-
collapseSpaces: false,
|
|
31
|
-
trim: false
|
|
32
|
-
}) => {
|
|
33
|
-
if (!chunkGKC3UDMC_cjs.isNonEmptyString(value)) return "";
|
|
34
|
-
let result = value;
|
|
35
|
-
if (!chunkGKC3UDMC_cjs.isPlainObject(options)) {
|
|
36
|
-
options = {};
|
|
37
|
-
}
|
|
38
|
-
const collapseSpaces = options.collapseSpaces === true;
|
|
39
|
-
const trim = options.trim === true;
|
|
40
|
-
if (trim) {
|
|
41
|
-
result = result.trim();
|
|
42
|
-
}
|
|
43
|
-
if (collapseSpaces) {
|
|
44
|
-
const leadingSpaces = result.match(/^\s*/)?.[0] ?? "";
|
|
45
|
-
const trailingSpaces = result.match(/\s*$/)?.[0] ?? "";
|
|
46
|
-
result = result.trim().replace(/\s+/g, " ");
|
|
47
|
-
result = `${leadingSpaces}${result}${trailingSpaces}`;
|
|
48
|
-
}
|
|
49
|
-
return result.toLowerCase().split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
function stripHtmlTags(input) {
|
|
53
|
-
if (!chunkGKC3UDMC_cjs.isString(input)) {
|
|
54
|
-
return void 0;
|
|
55
|
-
}
|
|
56
|
-
if (chunk4YLBKLGS_cjs.isEmptyString(input)) {
|
|
57
|
-
return "";
|
|
58
|
-
}
|
|
59
|
-
const stripped = input.replace(/<\/?[a-zA-Z][^<>]*\/?>/g, " ").trim();
|
|
60
|
-
const cleaned = stripped.replace(/\s+/g, " ").trim();
|
|
61
|
-
return cleaned;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
var getInitialsName = (name) => {
|
|
65
|
-
if (!chunkGKC3UDMC_cjs.isNonEmptyString(name)) return "";
|
|
66
|
-
name = name.replace(/\s+/g, " ").trim();
|
|
67
|
-
const nameParts = name.split(" ");
|
|
68
|
-
if (nameParts.length > 1) {
|
|
69
|
-
return nameParts[0][0] + nameParts[1][0].toUpperCase();
|
|
70
|
-
}
|
|
71
|
-
return name.length > 1 ? name.substring(0, 2).toUpperCase() : (
|
|
72
|
-
// First two letters for single-word names
|
|
73
|
-
name[0].toUpperCase()
|
|
74
|
-
);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
var replaceAt = (index, originalString, replaceTo) => {
|
|
78
|
-
if (!chunkGKC3UDMC_cjs.isNumber(index) || !chunkGKC3UDMC_cjs.isString(replaceTo) || !chunkGKC3UDMC_cjs.isString(originalString)) {
|
|
79
|
-
throw new TypeError(
|
|
80
|
-
`First parameter (\`index\`) must be of type \`number\`, second parameter (\`originalString\`) and third parameter (\`replaceTo\`) must be of type \`string\`, but received: "['index': \`${chunkGKC3UDMC_cjs.getPreciseType(
|
|
81
|
-
index
|
|
82
|
-
)}\`, 'originalString': \`${chunkGKC3UDMC_cjs.getPreciseType(
|
|
83
|
-
originalString
|
|
84
|
-
)}\`, 'replaceTo': \`${chunkGKC3UDMC_cjs.getPreciseType(replaceTo)}\`]".`
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
if (index < 0 || index >= originalString.length) {
|
|
88
|
-
throw new RangeError(
|
|
89
|
-
`First parameter (\`index\`) is out of range from second parameter (\`originalString\`).`
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
return originalString.slice(0, index) + // Extract before the index
|
|
93
|
-
replaceTo + // Insert replacement
|
|
94
|
-
originalString.slice(index + 1);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
exports.capitalizeFirst = capitalizeFirst;
|
|
98
|
-
exports.capitalizeWords = capitalizeWords;
|
|
99
|
-
exports.getInitialsName = getInitialsName;
|
|
100
|
-
exports.replaceAt = replaceAt;
|
|
101
|
-
exports.stripHtmlTags = stripHtmlTags;
|