@rzl-zone/utils-js 3.2.6-beta.0 → 3.3.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/README.md +14 -16
- package/dist/NumberRangeUnion-B6bhM2s7.d.ts +33 -0
- package/dist/{any-BmdI8UbK.d.ts → any-v4TsK9ES.d.ts} +25 -26
- package/dist/{arrays-normalize-recursive-CnjYJ9xg.d.ts → arrays-normalize-recursive-BqmVuFlD.d.ts} +20 -20
- package/dist/assertions/index.cjs +1 -1
- package/dist/assertions/index.d.ts +96 -70
- package/dist/assertions/index.js +1 -1
- package/dist/chunk-2CQX5CBG.js +1 -0
- package/dist/chunk-2IOOEY45.cjs +1 -0
- package/dist/chunk-3IBQ5MOM.js +1 -0
- package/dist/{chunk-OGPPP2S3.js → chunk-3VA554KW.js} +1 -1
- package/dist/{chunk-FV7SEBKD.cjs → chunk-5757UBXJ.cjs} +1 -1
- package/dist/{chunk-MTUBDVJ2.js → chunk-5IGC6PBH.js} +1 -1
- package/dist/{chunk-O7UT5AN3.cjs → chunk-5KJFVIQT.cjs} +1 -1
- package/dist/chunk-6JFCSH7J.js +1 -0
- package/dist/{chunk-VHAPTHEA.cjs → chunk-6JFZL7YE.cjs} +1 -1
- package/dist/chunk-7ODAAXX5.cjs +1 -0
- package/dist/{chunk-6C3ATUGM.cjs → chunk-CAH33WOQ.cjs} +1 -1
- package/dist/{chunk-ECRNH4FW.js → chunk-CKTLUNWX.js} +1 -1
- package/dist/chunk-CMW2TBOQ.js +1 -0
- package/dist/chunk-D3ENH7H6.cjs +1 -0
- package/dist/{chunk-3YCFMGRB.js → chunk-DEZZUYE2.js} +1 -1
- package/dist/chunk-DWF2R5GD.cjs +1 -0
- package/dist/chunk-E55EQK2U.cjs +1 -0
- package/dist/chunk-E74U6CYP.cjs +1 -0
- package/dist/{chunk-XC3QHAK2.cjs → chunk-EL6A35UR.cjs} +1 -1
- package/dist/chunk-F6IPNNSJ.cjs +1 -0
- package/dist/chunk-FJZGG54N.cjs +1 -0
- package/dist/chunk-FWCKOJZM.js +1 -0
- package/dist/{chunk-IMCLPT5V.cjs → chunk-FWHNWL2P.cjs} +1 -1
- package/dist/chunk-GGEADHZO.js +1 -0
- package/dist/{chunk-IRGE5W7L.js → chunk-GQR4R5WY.js} +1 -1
- package/dist/chunk-H66AC7GK.cjs +1 -0
- package/dist/{chunk-M47QIBXI.cjs → chunk-HQWOFR56.cjs} +1 -1
- package/dist/{chunk-VCFXNV3Q.cjs → chunk-HYRQMTRH.cjs} +1 -1
- package/dist/{chunk-EUANTHVN.js → chunk-IRFL4MAX.js} +1 -1
- package/dist/{chunk-GGWPB23G.cjs → chunk-IVL7CKVH.cjs} +1 -1
- package/dist/chunk-IZPBKKPO.js +1 -0
- package/dist/chunk-JBQMXC5I.cjs +1 -0
- package/dist/chunk-JEQEF5WD.js +1 -0
- package/dist/chunk-JMJQCN74.js +1 -0
- package/dist/chunk-JYQTCICM.js +1 -0
- package/dist/chunk-KVAL5PAG.cjs +1 -0
- package/dist/chunk-LS6U7FAY.cjs +1 -0
- package/dist/chunk-NBZWMBO6.js +1 -0
- package/dist/chunk-NRF6LWBC.cjs +1 -0
- package/dist/chunk-OI5XKNZO.js +1 -0
- package/dist/chunk-OYTYSY7G.js +1 -0
- package/dist/chunk-PET42Z7W.js +1 -0
- package/dist/chunk-PZQ6I4JJ.cjs +1 -0
- package/dist/chunk-QBKAEVYG.js +1 -0
- package/dist/{chunk-YV3K2EKJ.js → chunk-RIPKY4RU.js} +1 -1
- package/dist/chunk-RZW35UN5.cjs +1 -0
- package/dist/chunk-SBFNXGTJ.js +1 -0
- package/dist/{chunk-T4CIAKEK.js → chunk-SBKGWRS5.js} +1 -1
- package/dist/{chunk-5Z2G23WP.js → chunk-SIM77PU4.js} +1 -1
- package/dist/chunk-T2T7K3KR.js +1 -0
- package/dist/chunk-T7PU2V7X.cjs +1 -0
- package/dist/chunk-V45XJKHW.cjs +1 -0
- package/dist/chunk-W2WNBUDE.js +1 -0
- package/dist/chunk-XABCB3Y7.cjs +1 -0
- package/dist/chunk-XEDXFSGI.js +1 -0
- package/dist/chunk-YKPSRP5G.js +1 -0
- package/dist/chunk-YLA3DURS.cjs +1 -0
- package/dist/chunk-ZETAZZLD.cjs +1 -0
- package/dist/conversions/index.cjs +1 -1
- package/dist/conversions/index.d.ts +515 -321
- package/dist/conversions/index.js +1 -1
- package/dist/events/index.cjs +1 -1
- package/dist/events/index.d.ts +25 -20
- package/dist/events/index.js +1 -1
- package/dist/{extends-Bk_SBGdT.d.ts → extends-DtdRjDyU.d.ts} +63 -87
- package/dist/{formatting → formatters}/index.cjs +1 -1
- package/dist/formatters/index.d.ts +2106 -0
- package/dist/formatters/index.js +1 -0
- package/dist/generators/index.cjs +1 -0
- package/dist/{generator → generators}/index.d.ts +57 -59
- package/dist/generators/index.js +1 -0
- package/dist/{if-CvT4R7Kh.d.ts → if-ChM35c_q.d.ts} +6 -5
- package/dist/index.d.ts +14 -0
- package/dist/{is-array--YjXV-Wx.d.ts → is-array-BJeHxPM3.d.ts} +287 -542
- package/dist/{isPlainObject-BVhBAPHX.d.ts → isPlainObject-DGJkcFYw.d.ts} +6 -6
- package/dist/{never-BfayMBF9.d.ts → never-D89PbPh5.d.ts} +10 -19
- package/dist/next/index.cjs +1 -1
- package/dist/next/index.d.ts +15 -12
- package/dist/next/index.js +1 -1
- package/dist/next/server/index.cjs +1 -1
- package/dist/next/server/index.d.ts +1 -1
- package/dist/next/server/index.js +1 -1
- package/dist/{nils-DMz3kU7M.d.ts → nils-CO8zLHSB.d.ts} +39 -65
- package/dist/operations/index.cjs +1 -1
- package/dist/operations/index.d.ts +4 -4
- package/dist/operations/index.js +1 -1
- package/dist/or-C6qzKt2I.d.ts +82 -0
- package/dist/override-CL2olHE5.d.ts +59 -0
- package/dist/parsers/index.cjs +1 -1
- package/dist/parsers/index.js +1 -1
- package/dist/pick-BSMX6Xe2.d.ts +15 -0
- package/dist/predicates/index.cjs +1 -1
- package/dist/predicates/index.d.ts +425 -106
- package/dist/predicates/index.js +1 -1
- package/dist/prettify-3o8_Kw6b.d.ts +564 -0
- package/dist/promises/index.cjs +1 -0
- package/dist/promises/index.d.ts +107 -0
- package/dist/promises/index.js +1 -0
- package/dist/promises-LU7K00H0.d.ts +72 -0
- package/dist/rzl-utils.global.js +1 -1
- package/dist/{string-XA-til3C.d.ts → string-B1jlOnws.d.ts} +82 -121
- package/dist/strings/index.cjs +1 -1
- package/dist/strings/index.d.ts +209 -210
- package/dist/strings/index.js +1 -1
- package/dist/tailwind/index.cjs +1 -1
- package/dist/tailwind/index.d.ts +23 -17
- package/dist/tailwind/index.js +1 -1
- package/dist/types/index.d.ts +899 -1181
- package/dist/urls/index.cjs +1 -1
- package/dist/urls/index.d.ts +113 -108
- package/dist/urls/index.js +1 -1
- package/package.json +33 -40
- package/dist/NumberRangeUnion-DC-C3_Kq.d.ts +0 -26
- package/dist/chunk-2HSNUPEO.cjs +0 -1
- package/dist/chunk-4Z75R3IT.cjs +0 -1
- package/dist/chunk-AJ25PWXX.cjs +0 -1
- package/dist/chunk-BHIBDDQF.js +0 -1
- package/dist/chunk-CE4JI2YB.js +0 -1
- package/dist/chunk-CMJ6UYWW.cjs +0 -1
- package/dist/chunk-D3VSHABU.cjs +0 -1
- package/dist/chunk-DG2GWBTS.cjs +0 -1
- package/dist/chunk-EKS4IZJR.cjs +0 -1
- package/dist/chunk-EOZKYR5S.cjs +0 -1
- package/dist/chunk-EW3I4O7X.js +0 -1
- package/dist/chunk-F3E77L46.js +0 -1
- package/dist/chunk-G5LXIEFO.js +0 -0
- package/dist/chunk-GVWGQNLF.js +0 -1
- package/dist/chunk-H3FXL4DU.cjs +0 -1
- package/dist/chunk-HHPDLSX2.cjs +0 -1
- package/dist/chunk-JARPXKBM.cjs +0 -1
- package/dist/chunk-JFJUPYDT.cjs +0 -1
- package/dist/chunk-JLP56WSM.js +0 -1
- package/dist/chunk-K3MV4AIN.cjs +0 -1
- package/dist/chunk-KOVO72OM.js +0 -1
- package/dist/chunk-LJ4M3VGE.js +0 -1
- package/dist/chunk-LJVGJLP4.js +0 -1
- package/dist/chunk-MISCBZJC.js +0 -1
- package/dist/chunk-MMSYCIJ2.cjs +0 -1
- package/dist/chunk-OLPKAX7F.cjs +0 -1
- package/dist/chunk-ORZFHBEY.js +0 -1
- package/dist/chunk-OWV2P376.js +0 -1
- package/dist/chunk-RV2WK5E6.js +0 -1
- package/dist/chunk-SBF43G3B.cjs +0 -1
- package/dist/chunk-X74TUJSE.cjs +0 -1
- package/dist/chunk-XLDAIZRK.js +0 -1
- package/dist/chunk-XZJ7C4N6.js +0 -1
- package/dist/chunk-ZHV5ZYVN.cjs +0 -1
- package/dist/chunk-ZL7J6GTP.js +0 -1
- package/dist/chunk-ZTCLKKMB.js +0 -1
- package/dist/env/index.cjs +0 -1
- package/dist/env/index.d.ts +0 -16
- package/dist/env/index.js +0 -1
- package/dist/formatting/index.d.ts +0 -950
- package/dist/formatting/index.js +0 -1
- package/dist/generator/index.cjs +0 -1
- package/dist/generator/index.js +0 -1
- package/dist/omit-VvmIsZmX.d.ts +0 -28
- package/dist/prettify-C4xLcYOP.d.ts +0 -353
- package/dist/promise/index.cjs +0 -1
- package/dist/promise/index.d.ts +0 -31
- package/dist/promise/index.js +0 -1
- package/dist/type-data-DDs-u2kq.d.ts +0 -261
- /package/dist/{chunk-5C2SMIGX.cjs → chunk-BAV5T2E3.cjs} +0 -0
- /package/dist/{chunk-MC3LXMCQ.js → chunk-L5RDAVVH.js} +0 -0
- /package/dist/{chunk-J2RGTPGK.cjs → chunk-VJDDGRIK.cjs} +0 -0
- /package/dist/{chunk-FIAAX3UE.js → chunk-YWHHVDT4.js} +0 -0
package/dist/urls/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("../chunk-
|
|
1
|
+
"use strict";var e=require("../chunk-DWF2R5GD.cjs");require("../chunk-KHO2SBNA.cjs"),require("../chunk-E74U6CYP.cjs"),require("../chunk-NRF6LWBC.cjs"),require("../chunk-HQWOFR56.cjs"),require("../chunk-V45XJKHW.cjs"),require("../chunk-DVMHRLKP.cjs");var r=require("../chunk-H66AC7GK.cjs");require("../chunk-KVAL5PAG.cjs"),require("../chunk-E55EQK2U.cjs"),require("../chunk-ZETAZZLD.cjs"),require("../chunk-6JFZL7YE.cjs"),require("../chunk-T7PU2V7X.cjs"),require("../chunk-UDA26MCU.cjs"),require("../chunk-PZQ6I4JJ.cjs"),Object.defineProperty(exports,"constructURL",{enumerable:!0,get:function(){return e.constructURL}}),Object.defineProperty(exports,"extractURLs",{enumerable:!0,get:function(){return e.extractURLs}}),Object.defineProperty(exports,"getFirstPrefixPathname",{enumerable:!0,get:function(){return e.getFirstPrefixPathname}}),Object.defineProperty(exports,"getPrefixPathname",{enumerable:!0,get:function(){return e.getPrefixPathname}}),Object.defineProperty(exports,"formatEnvPort",{enumerable:!0,get:function(){return r.formatEnvPort}}),Object.defineProperty(exports,"normalizePathname",{enumerable:!0,get:function(){return r.normalizePathname}});
|
package/dist/urls/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* ----------------------------------------------------------
|
|
4
4
|
* **Represents a non-empty array of key–value pairs.**
|
|
5
5
|
* @description
|
|
6
|
-
* Type for `queryParams` parameter, the second parameter of **{@link constructURL}**.
|
|
6
|
+
* Type for `queryParams` parameter, the second parameter of **{@link constructURL | `constructURL`}**.
|
|
7
7
|
* - **Behavior:**
|
|
8
8
|
* - Each inner tuple strictly follows the `[string, string | number]` shape.
|
|
9
9
|
* - Ensures the outer array contains **at least one pair** (non-empty).
|
|
@@ -99,8 +99,107 @@ declare const constructURL:(baseUrl:string|URL,queryParams?:URLSearchParamsItera
|
|
|
99
99
|
* extractURLs("ftp://example.com http://example.com");
|
|
100
100
|
* // ➔ ["http://example.com"]
|
|
101
101
|
*/
|
|
102
|
-
declare const extractURLs:(url:string|null|undefined)=>string[]|null;
|
|
103
|
-
/**
|
|
102
|
+
declare const extractURLs:(url:string|null|undefined)=>string[]|null;
|
|
103
|
+
/** --------------------------------------------------------
|
|
104
|
+
* * ***Utility: `getFirstPrefixPathname`.***
|
|
105
|
+
* --------------------------------------------------------
|
|
106
|
+
* **Extract First Valid Prefix from Path Array or String.**
|
|
107
|
+
* - **Main Purpose:**
|
|
108
|
+
* - This function helps extract the first valid URL prefix from various possible inputs.
|
|
109
|
+
* - It is especially useful in routing systems, middleware, or frontend apps that need to
|
|
110
|
+
* decide layout, active navigation, or permissions based on the first segment (or prefix) of a pathname.
|
|
111
|
+
* - **Typical uses include:**
|
|
112
|
+
* - Determining which layout to render (e.g., `/admin` vs `/dashboard` vs `/`).
|
|
113
|
+
* - Highlighting the active menu item in a sidebar based on the current URL.
|
|
114
|
+
* - Enforcing route guards or access controls depending on the URL prefix.
|
|
115
|
+
* - Parsing multi-level route prefixes and selecting the most relevant one.
|
|
116
|
+
* - **Behavior:**
|
|
117
|
+
* - It works as follows:
|
|
118
|
+
* - If `result` is an array of strings, it normalizes each element and returns
|
|
119
|
+
* the first non-root path (i.e., not just `"/"`).
|
|
120
|
+
* - If all items normalize to `"/"`,
|
|
121
|
+
* it returns the `defaultValue` (normalized).
|
|
122
|
+
* - If `result` is a single string, it normalizes it and returns it if valid,
|
|
123
|
+
* otherwise falls back to the normalized `defaultValue`.
|
|
124
|
+
* - If `result` is `null` or `undefined`, it returns the normalized `defaultValue`.
|
|
125
|
+
* - **Validation & Errors:**
|
|
126
|
+
* - Throws a `TypeError` if:
|
|
127
|
+
* - `defaultValue` is not a string or empty-string.
|
|
128
|
+
* - `result` is an array that contains non-string elements.
|
|
129
|
+
* - `result` is a value that is neither `string`, `string[]`, nor `null`.
|
|
130
|
+
* @example
|
|
131
|
+
* 1. #### For React (*Determining layout*):
|
|
132
|
+
* ```ts
|
|
133
|
+
* const prefix = getFirstPrefixPathname(
|
|
134
|
+
* getPrefixPathname(
|
|
135
|
+
* "/admin/settings",
|
|
136
|
+
* ["/admin", "/dashboard"]
|
|
137
|
+
* )
|
|
138
|
+
* );
|
|
139
|
+
*
|
|
140
|
+
* if (prefix === "/admin") {
|
|
141
|
+
* renderAdminLayout();
|
|
142
|
+
* }
|
|
143
|
+
* ```
|
|
144
|
+
*
|
|
145
|
+
* 2. #### Setting active menu state:
|
|
146
|
+
* ```ts
|
|
147
|
+
* const activeSection = getFirstPrefixPathname(["", "/dashboard", "/profile"]);
|
|
148
|
+
* // ➔ "/dashboard"
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* 3. #### Providing graceful fallback:
|
|
152
|
+
* ```ts
|
|
153
|
+
* const section = getFirstPrefixPathname([], "/home");
|
|
154
|
+
* // ➔ "/home"
|
|
155
|
+
* ```
|
|
156
|
+
* 4. #### ✅ Using with an Array of Pathnames:
|
|
157
|
+
* ```ts
|
|
158
|
+
* const result = getPrefixPathname([" ", "/dashboard", "/settings"]);
|
|
159
|
+
* console.log(getFirstPrefixPathname(result));
|
|
160
|
+
* // ➔ "/dashboard"
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
163
|
+
* 5. #### ✅ Using with Single String:
|
|
164
|
+
* ```ts
|
|
165
|
+
* console.log(getFirstPrefixPathname("/profile/settings"));
|
|
166
|
+
* // ➔ "/profile/settings"
|
|
167
|
+
* console.log(getFirstPrefixPathname(" "));
|
|
168
|
+
* // ➔ "/"
|
|
169
|
+
* ```
|
|
170
|
+
*
|
|
171
|
+
* 6. #### ✅ Fallback to Custom Default:
|
|
172
|
+
* ```ts
|
|
173
|
+
* console.log(getFirstPrefixPathname([" ", ""], "/home"));
|
|
174
|
+
* // ➔ "/home"
|
|
175
|
+
* console.log(getFirstPrefixPathname(null, "/dashboard"));
|
|
176
|
+
* // ➔ "/dashboard"
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
* 7. #### ✅ Throws on Invalid Input:
|
|
180
|
+
* ```ts
|
|
181
|
+
* getFirstPrefixPathname([1, 2] as any); // ➔ ❌ throws TypeError
|
|
182
|
+
* getFirstPrefixPathname({} as any); // ➔ ❌ throws TypeError
|
|
183
|
+
* getFirstPrefixPathname(null, " "); // ➔ ❌ throws TypeError
|
|
184
|
+
* ```
|
|
185
|
+
* @param {string | string[] | null | undefined} result
|
|
186
|
+
* ***The pathname(s) to process, can be:***
|
|
187
|
+
* - A string path (e.g. `"/profile"`),
|
|
188
|
+
* - An array of string paths (e.g. `[" ", "/dashboard"]`),
|
|
189
|
+
* - Or `null`.
|
|
190
|
+
* @param {string} [defaultValue="/"]
|
|
191
|
+
* ***A custom default path to use if `result` is null or no valid prefix is found, behavior:***
|
|
192
|
+
* - Must be a string and non-empty string.
|
|
193
|
+
* - Defaults to `"/"`.
|
|
194
|
+
* @returns {string}
|
|
195
|
+
* ***The first valid normalized pathname, or the normalized default.***
|
|
196
|
+
* @throws {TypeError}
|
|
197
|
+
* ***If `result` is not a valid type, or `defaultValue` is not a string or empty-string.***
|
|
198
|
+
*/
|
|
199
|
+
declare const getFirstPrefixPathname:(result:string|string[]|null|undefined,defaultValue?:string)=>string;type GetPrefixPathnameOptions={
|
|
200
|
+
/** The number of levels to include in the prefix (default is `1`).
|
|
201
|
+
*
|
|
202
|
+
* - For example, with `levels = 2`, the function will return the first two parts of the URL.
|
|
104
203
|
*
|
|
105
204
|
* @default 1
|
|
106
205
|
*/
|
|
@@ -128,20 +227,24 @@ removeDuplicates?:boolean;};
|
|
|
128
227
|
* - The `url` parameter can be either a string or an array of strings.
|
|
129
228
|
* - Supports deduplication of results (enabled by default).
|
|
130
229
|
* - Automatically returns a single string if only one unique result exists after processing.
|
|
131
|
-
* @param {string|string[]} url
|
|
132
|
-
*
|
|
133
|
-
* @param {string|string[]|null} [base=null]
|
|
230
|
+
* @param {string|string[]} url
|
|
231
|
+
* ***The full URL(s) from which the prefix should be extracted, can be a `string` or an `array of strings`.***
|
|
232
|
+
* @param {string|string[]|null} [base=null]
|
|
233
|
+
* ***The base URL(s) (e.g., `"/settings"`), behavior:***
|
|
134
234
|
* - It can be a `string`, an `array of strings`, or `null`.
|
|
135
235
|
* - If `provided`, it will be used to check the URL(s).
|
|
136
236
|
* - If `not provided`, the prefix will be auto-detected.
|
|
137
|
-
* @param {GetPrefixPathnameOptions} [options]
|
|
237
|
+
* @param {GetPrefixPathnameOptions} [options]
|
|
238
|
+
* ***Additional options object:***
|
|
138
239
|
* - `levels` (default `1`): The number of segments to include when auto-detecting the prefix (e.g. `/foo/bar` for `levels: 2`).
|
|
139
240
|
* - `removeDuplicates` (default `true`): Whether to remove duplicate prefixes from the final array result.
|
|
140
|
-
* @returns {string|string[]|null}
|
|
241
|
+
* @returns {string|string[]|null}
|
|
242
|
+
* ***Returns one of:***
|
|
141
243
|
* - A single string if only one unique prefix/base is found.
|
|
142
244
|
* - An array of strings if multiple different prefixes/bases are found.
|
|
143
245
|
* - `null` if no matching base is found when using `base`.
|
|
144
|
-
* @throws {TypeError}
|
|
246
|
+
* @throws {TypeError}
|
|
247
|
+
* ***Throws if:***
|
|
145
248
|
* - `url` is `not a string` or `not an array of strings`.
|
|
146
249
|
* - `base` is `not a string`, `array of strings`, or `null`.
|
|
147
250
|
* - `options` is `not an object`.
|
|
@@ -235,103 +338,6 @@ removeDuplicates?:boolean;};
|
|
|
235
338
|
* ```
|
|
236
339
|
*/
|
|
237
340
|
declare const getPrefixPathname:(url:string|string[],base?:string|string[]|null,options?:GetPrefixPathnameOptions)=>string|string[]|null;
|
|
238
|
-
/** --------------------------------------------------------
|
|
239
|
-
* * ***Utility: `getFirstPrefixPathname`.***
|
|
240
|
-
* --------------------------------------------------------
|
|
241
|
-
* **Extract First Valid Prefix from Path Array or String.**
|
|
242
|
-
* - **Main Purpose:**
|
|
243
|
-
* - This function helps extract the first valid URL prefix from various possible inputs.
|
|
244
|
-
* - It is especially useful in routing systems, middleware, or frontend apps that need to
|
|
245
|
-
* decide layout, active navigation, or permissions based on the first segment (or prefix) of a pathname.
|
|
246
|
-
* - **Typical uses include:**
|
|
247
|
-
* - Determining which layout to render (e.g., `/admin` vs `/dashboard` vs `/`).
|
|
248
|
-
* - Highlighting the active menu item in a sidebar based on the current URL.
|
|
249
|
-
* - Enforcing route guards or access controls depending on the URL prefix.
|
|
250
|
-
* - Parsing multi-level route prefixes and selecting the most relevant one.
|
|
251
|
-
* - **Behavior:**
|
|
252
|
-
* - It works as follows:
|
|
253
|
-
* - If `result` is an array of strings, it normalizes each element and returns
|
|
254
|
-
* the first non-root path (i.e., not just `"/"`).
|
|
255
|
-
* - If all items normalize to `"/"`,
|
|
256
|
-
* it returns the `defaultValue` (normalized).
|
|
257
|
-
* - If `result` is a single string, it normalizes it and returns it if valid,
|
|
258
|
-
* otherwise falls back to the normalized `defaultValue`.
|
|
259
|
-
* - If `result` is `null` or `undefined`, it returns the normalized `defaultValue`.
|
|
260
|
-
* - **Validation & Errors:**
|
|
261
|
-
* - Throws a `TypeError` if:
|
|
262
|
-
* - `defaultValue` is not a string or empty-string.
|
|
263
|
-
* - `result` is an array that contains non-string elements.
|
|
264
|
-
* - `result` is a value that is neither `string`, `string[]`, nor `null`.
|
|
265
|
-
* @example
|
|
266
|
-
* 1. #### For React (*Determining layout*):
|
|
267
|
-
* ```ts
|
|
268
|
-
* const prefix = getFirstPrefixPathname(
|
|
269
|
-
* getPrefixPathname(
|
|
270
|
-
* "/admin/settings",
|
|
271
|
-
* ["/admin", "/dashboard"]
|
|
272
|
-
* )
|
|
273
|
-
* );
|
|
274
|
-
*
|
|
275
|
-
* if (prefix === "/admin") {
|
|
276
|
-
* renderAdminLayout();
|
|
277
|
-
* }
|
|
278
|
-
* ```
|
|
279
|
-
*
|
|
280
|
-
* 2. #### Setting active menu state:
|
|
281
|
-
* ```ts
|
|
282
|
-
* const activeSection = getFirstPrefixPathname(["", "/dashboard", "/profile"]);
|
|
283
|
-
* // ➔ "/dashboard"
|
|
284
|
-
* ```
|
|
285
|
-
*
|
|
286
|
-
* 3. #### Providing graceful fallback:
|
|
287
|
-
* ```ts
|
|
288
|
-
* const section = getFirstPrefixPathname([], "/home");
|
|
289
|
-
* // ➔ "/home"
|
|
290
|
-
* ```
|
|
291
|
-
* 4. #### ✅ Using with an Array of Pathnames:
|
|
292
|
-
* ```ts
|
|
293
|
-
* const result = getPrefixPathname([" ", "/dashboard", "/settings"]);
|
|
294
|
-
* console.log(getFirstPrefixPathname(result));
|
|
295
|
-
* // ➔ "/dashboard"
|
|
296
|
-
* ```
|
|
297
|
-
*
|
|
298
|
-
* 5. #### ✅ Using with Single String:
|
|
299
|
-
* ```ts
|
|
300
|
-
* console.log(getFirstPrefixPathname("/profile/settings"));
|
|
301
|
-
* // ➔ "/profile/settings"
|
|
302
|
-
* console.log(getFirstPrefixPathname(" "));
|
|
303
|
-
* // ➔ "/"
|
|
304
|
-
* ```
|
|
305
|
-
*
|
|
306
|
-
* 6. #### ✅ Fallback to Custom Default:
|
|
307
|
-
* ```ts
|
|
308
|
-
* console.log(getFirstPrefixPathname([" ", ""], "/home"));
|
|
309
|
-
* // ➔ "/home"
|
|
310
|
-
* console.log(getFirstPrefixPathname(null, "/dashboard"));
|
|
311
|
-
* // ➔ "/dashboard"
|
|
312
|
-
* ```
|
|
313
|
-
*
|
|
314
|
-
* 7. #### ✅ Throws on Invalid Input:
|
|
315
|
-
* ```ts
|
|
316
|
-
* getFirstPrefixPathname([1, 2] as any); // ➔ ❌ throws TypeError
|
|
317
|
-
* getFirstPrefixPathname({} as any); // ➔ ❌ throws TypeError
|
|
318
|
-
* getFirstPrefixPathname(null, " "); // ➔ ❌ throws TypeError
|
|
319
|
-
* ```
|
|
320
|
-
* @param {string | string[] | null | undefined} result
|
|
321
|
-
* The pathname(s) to process, can be:
|
|
322
|
-
* - A string path (e.g. `"/profile"`),
|
|
323
|
-
* - An array of string paths (e.g. `[" ", "/dashboard"]`),
|
|
324
|
-
* - Or `null`.
|
|
325
|
-
* @param {string} [defaultValue="/"]
|
|
326
|
-
* A custom default path to use if `result` is null or no valid prefix is found.
|
|
327
|
-
* - Must be a string and non-empty string.
|
|
328
|
-
* - Defaults to `"/"`.
|
|
329
|
-
* @returns {string}
|
|
330
|
-
* The first valid normalized pathname, or the normalized default.
|
|
331
|
-
* @throws {TypeError}
|
|
332
|
-
* If `result` is not a valid type, or `defaultValue` is not a string or empty-string.
|
|
333
|
-
*/
|
|
334
|
-
declare const getFirstPrefixPathname:(result:string|string[]|null|undefined,defaultValue?:string)=>string;
|
|
335
341
|
/** --------------------------------------------------------
|
|
336
342
|
* * ***Utility: `normalizePathname`.***
|
|
337
343
|
* --------------------------------------------------------
|
|
@@ -345,8 +351,7 @@ declare const getFirstPrefixPathname:(result:string|string[]|null|undefined,defa
|
|
|
345
351
|
* - Multiple consecutive slashes (like `"//"` or `"///"`) are collapsed into a single slash `"/"`.
|
|
346
352
|
* - Ensures the returned string always starts with exactly one `/`.
|
|
347
353
|
* @param {string | null | undefined} pathname - The pathname to normalize.
|
|
348
|
-
* @param {string} [defaultPath="/"] - A fallback value returned if `pathname` is empty or invalid
|
|
349
|
-
* - Must be a string and non-empty string, default `"/"`.
|
|
354
|
+
* @param {string} [defaultPath="/"] - A fallback value returned if `pathname` is empty or invalid, must be a string and non-empty string, default `"/"`.
|
|
350
355
|
* @returns {string} A properly normalized pathname starting with a single `/`,
|
|
351
356
|
* or the `defaultPath` if the input is invalid or empty.
|
|
352
357
|
* @throws {TypeError} If `defaultPath` is not a string or empty-string.
|
package/dist/urls/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{constructURL,extractURLs}from"../chunk-
|
|
1
|
+
export{constructURL,extractURLs,getFirstPrefixPathname,getPrefixPathname}from"../chunk-SBFNXGTJ.js";import"../chunk-ONZFBJVW.js";import"../chunk-IZPBKKPO.js";import"../chunk-OI5XKNZO.js";import"../chunk-GQR4R5WY.js";import"../chunk-3IBQ5MOM.js";import"../chunk-WVSPXFTY.js";export{formatEnvPort,normalizePathname}from"../chunk-GGEADHZO.js";import"../chunk-XEDXFSGI.js";import"../chunk-W2WNBUDE.js";import"../chunk-6JFCSH7J.js";import"../chunk-CKTLUNWX.js";import"../chunk-PET42Z7W.js";import"../chunk-QNKGP5DY.js";import"../chunk-CMW2TBOQ.js";
|
package/package.json
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rzl-zone/utils-js",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"engineStrict": true,
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
9
|
-
"main": "./dist/index.cjs",
|
|
10
|
-
"module": "./dist/index.js",
|
|
11
8
|
"unpkg": "./dist/rzl-utils.global.js",
|
|
12
9
|
"jsdelivr": "./dist/rzl-utils.global.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
13
11
|
"author": "Rizalvin Dwiky <rizalvindwiky1998@gmail.com>",
|
|
14
12
|
"homepage": "https://github.com/rzl-zone/utils-js#readme",
|
|
15
|
-
"description": "A modern, lightweight set of JavaScript utility functions for everyday development, crafted to enhance code readability and maintainability.",
|
|
13
|
+
"description": "A modern, lightweight set of JavaScript utility functions with TypeScript support for everyday development, crafted to enhance code readability and maintainability.",
|
|
16
14
|
"contributors": [
|
|
17
15
|
"Rizalvin Dwiky <rizalvindwiky1998@gmail.com>"
|
|
18
16
|
],
|
|
@@ -21,6 +19,7 @@
|
|
|
21
19
|
},
|
|
22
20
|
"dependencies": {
|
|
23
21
|
"date-fns": "^4.1.0",
|
|
22
|
+
"libphonenumber-js": "^1.12.17",
|
|
24
23
|
"server-only": "^0.0.1",
|
|
25
24
|
"tailwind-merge-v3": "npm:tailwind-merge@2.6.0",
|
|
26
25
|
"tailwind-merge-v4": "npm:tailwind-merge@3.3.1"
|
|
@@ -60,6 +59,9 @@
|
|
|
60
59
|
"node": ">=16"
|
|
61
60
|
},
|
|
62
61
|
"exports": {
|
|
62
|
+
".": {
|
|
63
|
+
"types": "./dist/index.d.ts"
|
|
64
|
+
},
|
|
63
65
|
"./assertions": {
|
|
64
66
|
"import": {
|
|
65
67
|
"types": "./dist/assertions/index.d.ts",
|
|
@@ -80,16 +82,6 @@
|
|
|
80
82
|
"default": "./dist/conversions/index.cjs"
|
|
81
83
|
}
|
|
82
84
|
},
|
|
83
|
-
"./env": {
|
|
84
|
-
"import": {
|
|
85
|
-
"types": "./dist/env/index.d.ts",
|
|
86
|
-
"default": "./dist/env/index.js"
|
|
87
|
-
},
|
|
88
|
-
"require": {
|
|
89
|
-
"types": "./dist/env/index.d.ts",
|
|
90
|
-
"default": "./dist/env/index.cjs"
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
85
|
"./events": {
|
|
94
86
|
"import": {
|
|
95
87
|
"types": "./dist/events/index.d.ts",
|
|
@@ -100,24 +92,24 @@
|
|
|
100
92
|
"default": "./dist/events/index.cjs"
|
|
101
93
|
}
|
|
102
94
|
},
|
|
103
|
-
"./
|
|
95
|
+
"./formatters": {
|
|
104
96
|
"import": {
|
|
105
|
-
"types": "./dist/
|
|
106
|
-
"default": "./dist/
|
|
97
|
+
"types": "./dist/formatters/index.d.ts",
|
|
98
|
+
"default": "./dist/formatters/index.js"
|
|
107
99
|
},
|
|
108
100
|
"require": {
|
|
109
|
-
"types": "./dist/
|
|
110
|
-
"default": "./dist/
|
|
101
|
+
"types": "./dist/formatters/index.d.ts",
|
|
102
|
+
"default": "./dist/formatters/index.cjs"
|
|
111
103
|
}
|
|
112
104
|
},
|
|
113
|
-
"./
|
|
105
|
+
"./generators": {
|
|
114
106
|
"import": {
|
|
115
|
-
"types": "./dist/
|
|
116
|
-
"default": "./dist/
|
|
107
|
+
"types": "./dist/generators/index.d.ts",
|
|
108
|
+
"default": "./dist/generators/index.js"
|
|
117
109
|
},
|
|
118
110
|
"require": {
|
|
119
|
-
"types": "./dist/
|
|
120
|
-
"default": "./dist/
|
|
111
|
+
"types": "./dist/generators/index.d.ts",
|
|
112
|
+
"default": "./dist/generators/index.cjs"
|
|
121
113
|
}
|
|
122
114
|
},
|
|
123
115
|
"./next": {
|
|
@@ -170,14 +162,14 @@
|
|
|
170
162
|
"default": "./dist/predicates/index.cjs"
|
|
171
163
|
}
|
|
172
164
|
},
|
|
173
|
-
"./
|
|
165
|
+
"./promises": {
|
|
174
166
|
"import": {
|
|
175
|
-
"types": "./dist/
|
|
176
|
-
"default": "./dist/
|
|
167
|
+
"types": "./dist/promises/index.d.ts",
|
|
168
|
+
"default": "./dist/promises/index.js"
|
|
177
169
|
},
|
|
178
170
|
"require": {
|
|
179
|
-
"types": "./dist/
|
|
180
|
-
"default": "./dist/
|
|
171
|
+
"types": "./dist/promises/index.d.ts",
|
|
172
|
+
"default": "./dist/promises/index.cjs"
|
|
181
173
|
}
|
|
182
174
|
},
|
|
183
175
|
"./strings": {
|
|
@@ -216,23 +208,23 @@
|
|
|
216
208
|
},
|
|
217
209
|
"typesVersions": {
|
|
218
210
|
"*": {
|
|
211
|
+
".": [
|
|
212
|
+
"./dist/index.d.ts"
|
|
213
|
+
],
|
|
219
214
|
"assertions": [
|
|
220
215
|
"dist/assertions/index.d.ts"
|
|
221
216
|
],
|
|
222
217
|
"conversions": [
|
|
223
218
|
"dist/conversions/index.d.ts"
|
|
224
219
|
],
|
|
225
|
-
"env": [
|
|
226
|
-
"dist/env/index.d.ts"
|
|
227
|
-
],
|
|
228
220
|
"events": [
|
|
229
221
|
"dist/events/index.d.ts"
|
|
230
222
|
],
|
|
231
|
-
"
|
|
232
|
-
"dist/
|
|
223
|
+
"formatters": [
|
|
224
|
+
"dist/formatters/index.d.ts"
|
|
233
225
|
],
|
|
234
|
-
"
|
|
235
|
-
"dist/
|
|
226
|
+
"generators": [
|
|
227
|
+
"dist/generators/index.d.ts"
|
|
236
228
|
],
|
|
237
229
|
"next": [
|
|
238
230
|
"dist/next/index.d.ts"
|
|
@@ -249,8 +241,8 @@
|
|
|
249
241
|
"predicates": [
|
|
250
242
|
"dist/predicates/index.d.ts"
|
|
251
243
|
],
|
|
252
|
-
"
|
|
253
|
-
"dist/
|
|
244
|
+
"promises": [
|
|
245
|
+
"dist/promises/index.d.ts"
|
|
254
246
|
],
|
|
255
247
|
"strings": [
|
|
256
248
|
"dist/strings/index.d.ts"
|
|
@@ -294,13 +286,14 @@
|
|
|
294
286
|
"url": "git+https://github.com/rzl-zone/utils-js.git"
|
|
295
287
|
},
|
|
296
288
|
"scripts": {
|
|
289
|
+
"generate:reference": "tsx scripts/generate-reference.ts",
|
|
297
290
|
"clean": "del-cli \"dist/*\"",
|
|
298
291
|
"prepublish": "npm run clean",
|
|
299
292
|
"prepare": "npm run build",
|
|
300
293
|
"prepublishOnly": "npm run barrel",
|
|
301
294
|
"check-publish": "npm pack --dry-run",
|
|
302
295
|
"delete-dist:index": "del-cli \"dist/index.{js,js.map,cjs,cjs.map}\" \"dist/index.d.{ts,cts}\"",
|
|
303
|
-
"postbuild": "del-cli \"dist/**/*.d.cts\" && npm run delete-dist:index",
|
|
296
|
+
"postbuild": "del-cli \"dist/**/*.d.cts\" && npm run delete-dist:index && npm run generate:reference",
|
|
304
297
|
"barrel:generate": "npx barrelsby --config barrelsby.config.json",
|
|
305
298
|
"barrel": "npm run barrel:generate && npm run barrel:generate && npx tsx scripts/removeBarrelsbyComment.ts ",
|
|
306
299
|
"barrel:remove-comment-dist": "tsx scripts/removeBarrelsbyComment.ts",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
type Enumerate<N extends number,Acc extends number[]=[]>=Acc["length"] extends N?Acc[number]:Enumerate<N,[...Acc,Acc["length"]]>;
|
|
2
|
-
/** --------------------------------------------------
|
|
3
|
-
* * ***Generate a union type of numbers from `From` to `To` using enumeration.***
|
|
4
|
-
* --------------------------------------------------
|
|
5
|
-
*
|
|
6
|
-
* @template From - Starting number of the range (inclusive).
|
|
7
|
-
* @template To - Ending number of the range (inclusive).
|
|
8
|
-
*
|
|
9
|
-
* @description
|
|
10
|
-
* Produces a **numeric union type** from `From` to `To` (inclusive),
|
|
11
|
-
* using a simpler approach based on `Enumerate<N>` helper type.
|
|
12
|
-
*
|
|
13
|
-
* - ✅ Straightforward & easy to reason about.
|
|
14
|
-
* - ⚠️ Still limited by TypeScript recursion depth (safe up to `999`).
|
|
15
|
-
* - ⚙️ Best used for **smaller ranges** or when readability matters.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```ts
|
|
19
|
-
* type RangeX = NumberRangeUnion<3, 6>;
|
|
20
|
-
* // ^? 3 | 4 | 5 | 6
|
|
21
|
-
*
|
|
22
|
-
* type RangeY = NumberRangeUnion<0, 2>;
|
|
23
|
-
* // ^? 0 | 1 | 2
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
type NumberRangeUnion<From extends number,To extends number>=From extends To?From:Exclude<Enumerate<To>,Enumerate<From>>extends never?never:Exclude<Enumerate<To>,Enumerate<From>>|To;export type{NumberRangeUnion as N};
|
package/dist/chunk-2HSNUPEO.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var r=require("./chunk-4Z75R3IT.cjs"),t=require("./chunk-D3VSHABU.cjs");exports.normalizeSpaces=(r,i={withTrim:!0,trimOnly:!1})=>{if(!t.isNonEmptyString(r))return"";t.isPlainObject(i)||(i={});const{trimOnly:e=!1,withTrim:n=!0}=i;return e?r.trim():(n&&(r=r.trim()),r.replace(/\s+/g," "))},exports.normalizeString=r=>t.isNonEmptyString(r)?r.trim():"",exports.removeSpaces=(r,i={trimOnly:!1})=>{if(!t.isNonEmptyString(r))return"";t.isPlainObject(i)||(i={});const{trimOnly:e=!1}=i;return e?r.trim():r.replace(/\s+/g,"")},exports.stripHtmlTags=function(i){if(!t.isString(i))return;return r.isEmptyString(i)?"":i.replace(/<\/?[a-zA-Z][^<>]*\/?>/g," ").trim().replace(/\s+/g," ").trim()};
|
package/dist/chunk-4Z75R3IT.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var r=require("./chunk-D3VSHABU.cjs");exports.isEmptyString=(t,i={})=>!r.isNonEmptyString(t,i);
|
package/dist/chunk-AJ25PWXX.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("./chunk-D3VSHABU.cjs");exports.getInitialsName=r=>{if(!e.isNonEmptyString(r))return"";const t=(r=r.replace(/\s+/g," ").trim()).split(" ");return t.length>1?t[0][0]+t[1][0].toUpperCase():r.length>1?r.substring(0,2).toUpperCase():r[0].toUpperCase()},exports.replaceAt=(r,t,i)=>{if(!e.isNumber(r)||!e.isString(i)||!e.isString(t))throw new TypeError(`First parameter (\`index\`) must be of type \`number\`, second parameter (\`originalString\`) and third parameter (\`replaceTo\`) must be of type \`string\`, but received: "['index': \`${e.getPreciseType(r)}\`, 'originalString': \`${e.getPreciseType(t)}\`, 'replaceTo': \`${e.getPreciseType(i)}\`]".`);if(r<0||r>=t.length)throw new RangeError("First parameter (`index`) is out of range from second parameter (`originalString`).");return t.slice(0,r)+i+t.slice(r+1)};
|
package/dist/chunk-BHIBDDQF.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{isBigInt as r}from"./chunk-QNKGP5DY.js";import{isNaN as t,assertIsPlainObject as e,hasOwnProp as o,isBoolean as n,getPreciseType as s,isFunction as a,isSymbol as i,isUndefined as f,isObjectOrArray as u,isSet as c,isArray as p,isNull as y,isNumber as m,isObject as l}from"./chunk-EW3I4O7X.js";function b(r){return"[object Map]"===Object.prototype.toString.call(r)||r instanceof Map}var S=r=>r instanceof Date&&!t(r.getTime()),g=(g,d={})=>{e(d,{message:({currentType:r,validType:t})=>`Second parameter (\`options\`) must be of type \`${t}\`, but received: \`${r}\`.`});const h=!!o(d,"pretty")&&d.pretty,A=!o(d,"sortKeys")||d.sortKeys,N=!!o(d,"sortArray")&&d.sortArray;if(!n(A)||!n(N)||!n(h))throw new TypeError(`Parameters \`sortKeys\`, \`sortArray\` and \`pretty\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: "['sortKeys': \`${s(A)}\`, 'sortArray': \`${s(N)}\`, 'pretty': \`${s(h)}\`]".`);const j=new WeakSet,v=r=>y(r)||!u(r)&&!a(r),K=e=>{if(e instanceof Number)return Number(e);if(e instanceof String)return String(e);if(e instanceof Boolean)return Boolean(e);if(!a(e)&&!i(e)){if(r(e))return e.toString();if(f(e)||t(e)||e===1/0||e===-1/0)return null;if(u(e)){if(j.has(e))return"[Circular]";if(j.add(e),S(e))return e.toISOString();if(b(e))return{map:Array.from(e.entries()).map(([r,t])=>[r,K(t)])};if(c(e))return{set:Array.from(e.values()).map(K)};if(p(e)){const r=e.map(K);if(N){const t=[],e=[];for(const o of r)v(o)?t.push(o):e.push(o);return t.sort((r,t)=>m(r)&&m(t)?r-t:String(r).localeCompare(String(t))),[...t,...e]}return r}const r=Object.keys(e);A&&r.sort((r,e)=>{const o=Number(r),n=Number(e);return t(o)||t(n)?r.localeCompare(e):o-n});const o={};if(l(e))for(const t of r){const r=K(e[t]);f(r)||(o[t]=r)}return o}return e}};try{return JSON.stringify(K(g),null,h?2:0)}catch(r){return console.warn("Error in safeStableStringify:",r),"{}"}};export{S as isDate,b as isMap,g as safeStableStringify};
|
package/dist/chunk-CE4JI2YB.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{safeJsonParse as e}from"./chunk-XLDAIZRK.js";import{isEqual as r,isEmptyArray as t}from"./chunk-ZTCLKKMB.js";import{assertIsArray as n}from"./chunk-ECRNH4FW.js";import{safeStableStringify as s}from"./chunk-BHIBDDQF.js";import{isPlainObject as i,isNonEmptyArray as o,isObjectOrArray as c,isArray as a,isNaN as u,isUndefined as m}from"./chunk-EW3I4O7X.js";var f=e=>{n(e,{message:({currentType:e,validType:r})=>`First parameter (\`values\`) must be of type \`${r}\` (array literal or instance), but received: \`${e}\`.`});const t=[];return e.forEach((n,s)=>{for(let i=s+1;i<e.length;i++)if(r(n,e[i])){t.some(e=>r(e,n))||t.push(n);break}}),t},p=(e,r)=>{if(!i(e))return{};n(r,{message:({currentType:e,validType:r})=>`Second parameter (\`keysToOmit\`) must be of type \`${r}\` (array literal or instance), but received: \`${e}\`.`});const t=f(r);if(t.length>0)throw new Error(`Function "omitKeys" Error: Duplicate keys detected - \`${t}\``);return Object.fromEntries(Object.entries(e).filter(([e])=>!r.includes(e)))},l=(r,p)=>{if(!i(r))return{};n(p,{message:({currentType:e,validType:r})=>`Second parameter (\`keysToOmit\`) must be of type \`${r}\` (array literal or instance), but received: \`${e}\`.`});const l=f(p);if(o(l))throw new Error(`Function "omitKeysDeep" Error: Duplicate keys detected - \`${s(l)}\`.`);const y=(e,r)=>{if(!c(e))return e;const[n,...s]=r;if(t(s))if(a(e)){const r=parseInt(n);!u(r)&&r in e&&e.splice(r,1)}else delete e[n];else{const r=e[n];c(r)&&(e[n]=y(r,s))}return e},d=e=>{if(a(e))return e.map(d).filter(e=>!(c(e)&&0===Object.keys(e).length));if(c(e)){return Object.fromEntries(Object.entries(e).map(([e,r])=>[e,d(r)]).filter(([,e])=>!(m(e)||c(e)&&0===Object.keys(e).length)))}return e},b=e(s(r));for(const e of p){const r=e.split(".");y(b,r)}return d(b)};export{f as findDuplicates,p as omitKeys,l as omitKeysDeep};
|
package/dist/chunk-CMJ6UYWW.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var i=require("./chunk-D3VSHABU.cjs");exports.isFinite=function(e){return i.isNumber(e)&&Number.isFinite(e)};
|
package/dist/chunk-D3VSHABU.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=e=>"boolean"==typeof e,r=e=>"function"==typeof e;function t(e){return null==e}function o(e){return Array.isArray(e)}function a(e){return"object"==typeof e&&!t(e)&&!o(e)}function n(e){if(!a(e))return!1;const r=Object.getPrototypeOf(e);return r===Object.prototype||null===r}var s=e=>"string"==typeof e;function i(e){return"number"==typeof e?Number.isNaN(e):"[object Number]"===Object.prototype.toString.call(e)&&Number.isNaN(Number(e).valueOf())}var l=e=>null===e,c=(r,t={})=>{if(e(r))return;const o=U({value:r,options:t,requiredValidType:"boolean"});throw new TypeError(o)},u=(r,t={})=>{$(t,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const o=!(!n(t)||!e(t.includeNaN))&&t.includeNaN;c(o,{message:({currentType:e,validType:r})=>`Parameter \`includeNaN\` property of the \`options\` (second parameter) must be of type \`${r}\`, but received: \`${e}\`.`});const a="number"==typeof r;return o?a:a&&!Number.isNaN(r)},p=e=>"symbol"==typeof e,f=e=>void 0===e;function m(e){return o(e)||a(e)}function y(e,t,o={}){if(!s(e)&&!m(e)&&!r(e))return!1;$(o,{message:({currentType:e,validType:r})=>`Third parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const a=void 0===o.discardUndefined||o.discardUndefined,n=void 0!==o.discardNull&&o.discardNull;c(a,{message:({currentType:e,validType:r})=>`Parameter \`discardUndefined\` property of the \`options\` (third parameter) must be of type \`${r}\`, but received: \`${e}\`.`}),c(n,{message:({currentType:e,validType:r})=>`Parameter \`discardNull\` property of the \`options\` (third parameter) must be of type \`${r}\`, but received: \`${e}\`.`});const y=[];if(s(t)&&t.trim().length>0||u(t,{includeNaN:!0})){(u(t,{includeNaN:!0})?String(t):t).split(".").forEach(e=>{const r=e.match(/^\[(\d+)\]$/),t=e.match(/^Symbol\((.+)\)$/);r?y.push(Number(r[1])):t?y.push(Symbol.for(t[1])):i(Number(e))?y.push(e):y.push(Number(e))})}else{if(!p(t))return!1;y.push(t)}let b=s(e)&&e.trim().length>0?Object(e):e;for(const e of y)if(s(e)&&e.trim().length>0||u(e,{includeNaN:!0})){if(l(b)||!Object.prototype.hasOwnProperty.call(b,e))return!1;b=b[e]}else{if(!p(e))return!1;{if(l(b)||"object"!=typeof b&&!r(b))return!1;const t=Object.getOwnPropertySymbols(b).find(r=>r===e||r.description===e.description);if(!t)return!1;b=b[t]}}return(!a||!f(b))&&(!n||!l(b))}var b=(e,r={})=>{if(!s(e))return!1;$(r,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const t=!y(r,"trim")||r.trim;c(t,{message:({currentType:e,validType:r})=>`Parameter \`trim\` property of the \`options\` (second parameter) must be of type \`${r}\`, but received: \`${e}\`.`});return(t?e.trim():e).length>0};function d(e){return"[object Set]"===Object.prototype.toString.call(e)||e instanceof Set}function g(e){return Array.isArray(e)&&e.length>0}var v=e=>{let r="";return o(e)?r=e.map(e=>b(e)?e.trim():"").filter(e=>e.length).join("-"):b(e)&&(r=e.trim()),r.split(/[^\p{L}\p{N}]+/u).filter(Boolean)},h=e=>{const r=new Set([]),t=e=>e.trim().split(/[^\p{L}\p{N}]+/u).filter(Boolean).join("");if(b(e)){const o=t(e);o&&r.add(o)}return g(e)&&e.forEach(e=>{if(b(e)){const o=t(e);o&&r.add(o)}}),d(e)&&e.forEach(e=>{if(b(e)){const o=t(e);o&&r.add(o)}}),r},S=(e,r)=>{if(!g(e)&&!b(e))return"";const t=v(e),o=h(r);return t.map((e,r)=>o.has(e)?e:0===r?e.toLowerCase():e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join("")},j=(e,r)=>{if(!g(e)&&!b(e))return"";const t=v(e),o=h(r);return t.map(e=>o.has(e)?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")},C=(e,r)=>{if(!g(e)&&!b(e))return"";const t=v(e),o=h(r);return t.map(e=>o.has(e)?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join("")},N=(e,r)=>{if(!g(e)&&!b(e))return"";const t=v(e),o=h(r);return t.map(e=>o.has(e)?e:e.toLowerCase()).join(" ")},x=(e,r)=>{if(!g(e)&&!b(e))return"";const t=v(e),o=h(r);return t.map(e=>o.has(e)?e:e.toLowerCase()).join("-")},w=(e,r)=>{if(!g(e)&&!b(e))return"";const t=v(e),o=h(r);return t.map(e=>o.has(e)?e:e.toLowerCase()).join("_")},A=(e,r)=>{if(!g(e)&&!b(e))return"";const t=v(e),o=h(r);return t.map(e=>o.has(e)?e:e.toLowerCase()).join(".")},T=(e,r)=>{if(!g(e)&&!b(e))return"";const t=v(e),o=h(r);return t.map(e=>o.has(e)?e:e.toLowerCase()).join("-").replace(/^-+|-+$/g,"")},P=e=>"[object Error]"===Object.prototype.toString.call(e)||e instanceof Error,O=e=>"undefined"!=typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(e),E=Object.freeze(["URI","URL","HTTP","HTTPS","HTML","XML","CSS","JS","JSON","SVG","DOM","UTC","XHR","RTC","ICE","TLS","TCP","UDP","IDB","ID"]),I=e=>e.replace(/[\s_\-]+/g,"").toLowerCase(),R=Object.entries({string:"String",number:"Number",boolean:"Boolean",bigint:"Big Int",symbol:"Symbol",undefined:"Undefined",null:"Null",regexp:"Reg Exp",reflect:"Reflect",proxy:"Proxy",atomics:"Atomics",object:"Object",array:"Array",arguments:"Arguments",function:"Function",asyncfunction:"Async Function",generatorfunction:"Generator Function",asyncgeneratorfunction:"Async Generator Function",generator:"Generator",promise:"Promise",evalerror:"Eval Error",rangeerror:"Range Error",referenceerror:"Reference Error",syntaxerror:"Syntax Error",typeerror:"Type Error",urierror:"URI Error",aggregateerror:"Aggregate Error",error:"Error",int8array:"Int 8 Array",uint8array:"Uint 8 Array",uint8clampedarray:"Uint 8 Clamped Array",int16array:"Int 16 Array",uint16array:"Uint 16 Array",int32array:"Int 32 Array",uint32array:"Uint 32 Array",float32array:"Float 32 Array",float64array:"Float 64 Array",bigint64array:"Big Int 64 Array",biguint64array:"Big Uint 64 Array",arraybuffer:"Array Buffer",sharedarraybuffer:"Shared Array Buffer",dataview:"Data View",arraybufferview:"Array Buffer View",map:"Map",set:"Set",weakmap:"Weak Map",weakset:"Weak Set",mapiterator:"Map Iterator",setiterator:"Set Iterator",arrayiterator:"Array Iterator",stringiterator:"String Iterator",readablestream:"Readable Stream",writablestream:"Writable Stream",transformstream:"Transform Stream",readablestreamdefaultreader:"Readable Stream Default Reader",writablestreamdefaultwriter:"Writable Stream Default Writer",readablestreamdefaultcontroller:"Readable Stream Default Controller",transformstreamdefaultcontroller:"Transform Stream Default Controller",abortcontroller:"Abort Controller",abortsignal:"Abort Signal",fetch:"fetch",request:"Request",response:"Response",headers:"Headers",formdata:"FormData",blob:"Blob",file:"File",filelist:"FileList",filereader:"FileReader",intl:"Intl",collator:"Intl. Collator",datetimeformat:"Intl. Date Time Format",listformat:"Intl. List Format",numberformat:"Intl. Number Format",pluralrules:"Intl. Plural Rules",relativetimeformat:"Intl. Relative Time Format",segmenter:"Intl. Segmenter",locale:"Intl. Locale",displaynames:"Intl. Display Names",finalizationregistry:"Finalization Registry",weakref:"Weak Ref",structuredclone:"structured Clone",urlpattern:"URL Pattern",performance:"Performance",performanceobserver:"Performance Observer",performanceentry:"Performance Entry",performancemark:"Performance Mark",performancemeasure:"Performance Measure",webassembly:"Web Assembly",wasmmodule:"WebAssembly .Module",wasminstance:"WebAssembly. Instance",wasmmemory:"WebAssembly. Memory",wasmtable:"WebAssembly. Table",buffer:"Buffer",process:"Process",eventemitter:"Event Emitter",stream:"Stream",fs:"fs",path:"path",url:"URL",urlsearchparams:"URL Search Params",node:"Node",element:"Element",htmlelement:"HTML Element",svgelement:"SVG Element",document:"Document",documentfragment:"Document Fragment",shadowroot:"Shadow Root",nodelist:"Node List",htmlcollection:"HTML Collection",mutationobserver:"Mutation Observer",intersectionobserver:"Intersection Observer",resizeobserver:"Resize Observer"}).reduce((e,[r,t])=>(e[I(r)]=t,e),{});var L=(e,r)=>"toPascalCaseSpace"===r?j(e,E):"slugify"===r?T(e,E):"toCamelCase"===r?S(e,E):"toDotCase"===r?A(e,E):"toKebabCase"===r?x(e,E):"toPascalCase"===r?C(e,E):"toSnakeCase"===r?w(e,E):N(e,E),B=(e,t={formatCase:"toLowerCase"})=>{var o,s;n(t)||(t={});const c=t.formatCase;if(l(e))return L(R[I("null")]??"Null",c);if(i(e))return"NaN";if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(e instanceof Number)return L("Number Constructor",c);if(e instanceof String)return L("String Constructor",c);if(e instanceof Boolean)return L("Boolean Constructor",c);const u=typeof e;if(!m(e)&&!r(e))return L(R[I(u)]??u,c);if(O(e))return L(R[I("buffer")]??"Buffer",c);if(function(e){if("object"!=typeof e||null===e)return!1;const r=Object.prototype.toString.call(e);if(["[object Array]","[object Date]","[object RegExp]","[object Map]","[object Set]","[object WeakMap]","[object WeakSet]","[object Function]","[object Error]","[object Promise]","[object Generator]","[object GeneratorFunction]","[object AsyncFunction]"].includes(r))return!1;try{return Reflect.defineProperty(e,"__proxy_detect__",{configurable:!0,value:1}),Reflect.deleteProperty(e,"__proxy_detect__"),!1}catch{return!0}}(e))return L(R[I("proxy")]??"Proxy",c);if(a(e)&&r(null==e?void 0:e.next)&&r(null==e?void 0:e.throw))return L(R[I("generator")]??"Generator",c);if(P(e)){const r=(null==(o=e.constructor)?void 0:o.name)??"Error";return L(R[I(r)]??R[I(r.replace(/\s+/g,""))]??r,c)}if(l(Object.getPrototypeOf(e)))return L(R[I("object")]??"Object",c);const p=Object.prototype.toString.call(e).slice(8,-1)||"Object",f=R[I(p)];if(f)return L(f,c);const y=null==(s=null==e?void 0:e.constructor)?void 0:s.name;return L(y&&"Object"!==y?R[I(y)]??y:p,c)};function U(e){const{requiredValidType:t,value:o,options:a}=e||{},{message:s,formatCase:i}=n(a)?a:{},l=x(t),c=B(o,{formatCase:i}),u={currentType:c,validType:l},p=`Parameter input (\`value\`) must be of type \`${l}\`, but received: \`${c}\`.`;return r(s)?b(s(u))?s(u).trim():p:b(s)?s.trim():p}function $(e,r={}){if(n(e))return;const t=U({value:e,options:r,requiredValidType:"plain object"});throw new TypeError(t)}exports.assertIsBoolean=c,exports.assertIsPlainObject=$,exports.capitalizeFirst=(e,r={lowerCaseNextRest:!0,trim:!1})=>{if(!b(e))return"";n(r)||(r={});const t=!1!==r.lowerCaseNextRest;return!0===r.trim&&(e=e.trim()),e[0].toUpperCase()+(t?e.slice(1).toLowerCase():e.slice(1))},exports.capitalizeWords=(e,r={collapseSpaces:!1,trim:!1})=>{var t,o;if(!b(e))return"";let a=e;n(r)||(r={});const s=!0===r.collapseSpaces;if(!0===r.trim&&(a=a.trim()),s){const e=(null==(t=a.match(/^\s*/))?void 0:t[0])??"",r=(null==(o=a.match(/\s*$/))?void 0:o[0])??"";a=a.trim().replace(/\s+/g," "),a=`${e}${a}${r}`}return a.toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")},exports.getPreciseType=B,exports.hasOwnProp=y,exports.isArray=o,exports.isBoolean=e,exports.isBuffer=O,exports.isError=P,exports.isFunction=r,exports.isNaN=i,exports.isNil=t,exports.isNonEmptyArray=g,exports.isNonEmptyString=b,exports.isNull=l,exports.isNumber=u,exports.isObject=a,exports.isObjectOrArray=m,exports.isPlainObject=n,exports.isSet=d,exports.isString=s,exports.isSymbol=p,exports.isUndefined=f,exports.resolveErrorMessageAssertions=U,exports.slugify=T,exports.toCamelCase=S,exports.toDotCase=A,exports.toKebabCase=x,exports.toLowerCase=N,exports.toPascalCase=C,exports.toPascalCaseSpace=j,exports.toSnakeCase=w;
|
package/dist/chunk-DG2GWBTS.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("./chunk-6C3ATUGM.cjs"),r=require("./chunk-H3FXL4DU.cjs"),t=require("./chunk-JARPXKBM.cjs"),i=require("./chunk-VHAPTHEA.cjs"),s=require("./chunk-CMJ6UYWW.cjs"),n=require("./chunk-4Z75R3IT.cjs"),o=require("./chunk-VCFXNV3Q.cjs"),a=require("./chunk-ZHV5ZYVN.cjs"),m=require("./chunk-UDA26MCU.cjs"),y=require("./chunk-D3VSHABU.cjs");var p=e=>!y.isNil(e)&&(y.isString(e)?y.isNonEmptyString(e):y.isBoolean(e)?e:y.isNumber(e,{includeNaN:!0})?0!==e:y.isArray(e)?e.some(p):!!y.isObject(e)&&Object.values(e).some(p)),c=(e,r)=>{if(!y.isObjectOrArray(e))return e;const[i,...s]=r;if(y.isArray(e))for(const t of e)y.isObjectOrArray(t)&&c(t,r);else t.isEmptyArray(s)?y.isPlainObject(e)&&delete e[i]:y.isPlainObject(e)&&y.isObjectOrArray(e[i])&&c(e[i],s);return e},u=(e,r)=>{if(!y.isPlainObject(e))return e;const[t,...i]=r;return 0===i.length?y.isPlainObject(e)&&delete e[t]:y.isPlainObject(e[t])&&u(e[t],i),e};exports.convertType=e=>{const r={undefined:void 0,null:null,nan:NaN,true:!0,false:!1,yes:!0,no:!1};if(y.isString(e)){const t=e.trim().toLowerCase();if(Object.prototype.hasOwnProperty.call(r,t))return r[t];const i=t.replace(/,/g,""),s=Number(i);return!y.isNaN(s)&&y.isNonEmptyString(i)?s:e.trim()}return e},exports.removeObjectPaths=function(e,r,s=!0){if(t.isEmptyObject(e,{checkSymbols:!0}))return{};if(i.assertIsArray(r,{message:({currentType:e,validType:t})=>`Second parameter (\`keysToDelete\`) must be of type \`${t}\` with value of { key: string, deep?: boolean } plain-object, but received: \`${e}\`, with value: \`${a.safeStableStringify(r)}\`.`}),!r.every(e=>y.isPlainObject(e)&&"key"in e))throw new TypeError(`Each element in Second Parameter (\`keysToDelete\`) must be of type \`plain-object\` with at least a "key" property (optionally "deep"), but received: \`${a.safeStableStringify(r)}\`.`);let n=s?(e=>{try{if(y.isFunction(structuredClone))return structuredClone(e)}catch{}return JSON.parse(JSON.stringify(e))})(e):e;for(const{key:e,deep:t}of r){if(o.assertIsString(e,{message:({currentType:e,validType:r})=>`Parameter \`key\` at Second Parameter (\`keysToDelete\`) must be of type \`${r}\`, but received: \`${e}\`.`}),!y.isUndefined(t)&&!y.isBoolean(t))throw new TypeError(`Parameter \`deep\` at Second Parameter (\`keysToDelete\`) ➔ (key: "${e}", deep: ${t}) must be of type \`boolean\` or \`undefined\`, but received: \`${y.getPreciseType(t)}\`.`);const r=e.split(".");n=t?c(n,r):u(n,r)}return n},exports.toBooleanContent=r=>!y.isNil(r)&&(y.isString(r)?y.isNonEmptyString(r):y.isBoolean(r)?r:y.isNumber(r,{includeNaN:!0})?0!==r:y.isArray(r)||y.isObject(r)?e.isNonEmptyValue(r):Boolean(r)),exports.toBooleanContentDeep=p,exports.toBooleanExplicit=(e,r={})=>{if(y.isNil(e))return!1;y.isPlainObject(r)||(r={});const t=!!y.hasOwnProp(r,"caseInsensitive")&&r.caseInsensitive,i=!y.hasOwnProp(r,"trimString")||r.trimString,s=!!y.hasOwnProp(r,"includeIndeterminate")&&r.includeIndeterminate;if(!y.isBoolean(t)||!y.isBoolean(i)||!y.isBoolean(s))throw new TypeError(`Parameters \`caseInsensitive\`, \`trimString\` and \`includeIndeterminate\` property of the \`options\` (second parameter) expected to be a \`boolean\` type, but received: ['caseInsensitive': \`${y.getPreciseType(t)}\`, 'trimString': \`${y.getPreciseType(i)}\`, 'includeIndeterminate': \`${y.getPreciseType(s)}\`].`);if(y.isString(e)){let r=e;i&&(r=r.trim()),t&&(r=r.toLowerCase());const n=["true","on","yes","1"];return s&&n.push("indeterminate"),n.includes(r)}return y.isNumber(e)?1===e:!!y.isBoolean(e)&&e},exports.toBooleanLoose=e=>!y.isNil(e)&&(y.isString(e)?!n.isEmptyString(e):y.isBoolean(e)?e:y.isNumber(e,{includeNaN:!0})?0!==e:y.isArray(e)?e.length>0:Boolean(e)),exports.toNumberArrayUnRecursive=function(e,t={}){y.assertIsPlainObject(t,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const i=!y.hasOwnProp(t,"removeInvalidValueNumber")||t.removeInvalidValueNumber;if(y.assertIsBoolean(i,{message:({currentType:e,validType:r})=>`Parameter \`removeInvalidValueNumber\` property of the \`options\` (second parameter) must be of type \`${r}\`, but received: \`${e}\`.`}),y.isArray(e)){const t=Array.from(e,e=>{if(m.isBigInt(e))return Number(e);const r=String(e).trim().match(/-?\d+(\.\d+)?/);return r?Number(r[0]):y.isNull(e)?null:void 0});return i?r.filterNilArray(t):t}},exports.toNumberDeep=function(r,i={}){return y.assertIsPlainObject(i,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`}),function r(i,n){if(y.isNil(i))return;const{removeEmptyArrays:o,removeEmptyObjects:m,isRoot:p}=n;if(!y.isBoolean(m)||!y.isBoolean(o))throw new TypeError(`Parameters \`removeEmptyObjects\` and \`removeEmptyArrays\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: ['removeEmptyObjects': \`${y.getPreciseType(m)}\`, 'removeEmptyArrays': \`${y.getPreciseType(o)}\`].`);if(y.isNumber(i)||y.isNonEmptyString(i)&&!y.isNaN(Number(i))){const e=Number(i);return s.isFinite(e)?e:void 0}if(y.isArray(i)){const e=i.map(e=>r(e,{removeEmptyObjects:m,removeEmptyArrays:o,isRoot:!1})).filter(e=>!y.isUndefined(e));if(o&&t.isEmptyArray(e))return;return e}if(y.isSet(i)){const e=Array.from(i).map(e=>r(e,{removeEmptyObjects:m,removeEmptyArrays:o,isRoot:!1})).filter(e=>!y.isUndefined(e));if(o&&t.isEmptyArray(e))return;return e}if(a.isMap(i)){let e=Array.from(i.entries()).map(([e,t])=>{const i=r(e,{removeEmptyObjects:m,removeEmptyArrays:o,isRoot:!1}),s=r(t,{removeEmptyObjects:m,removeEmptyArrays:o,isRoot:!1});return y.isUndefined(i)||y.isUndefined(s)?void 0:[i,s]}).filter(e=>!y.isUndefined(e));if(o&&(e=e.filter(e=>!(y.isArray(e)&&0===e.length))),o&&t.isEmptyArray(e))return;return e}if(y.isBuffer(i)){const e=Array.from(i).map(e=>r(e,{removeEmptyObjects:m,removeEmptyArrays:o,isRoot:!1})).filter(e=>!y.isUndefined(e));if(o&&t.isEmptyArray(e))return;return e}if(e.isTypedArray(i)){if(i instanceof BigInt64Array||i instanceof BigUint64Array){const e=Array.from(i).map(e=>r(e,{removeEmptyObjects:m,removeEmptyArrays:o,isRoot:!1})).filter(e=>!y.isUndefined(e));if(o&&t.isEmptyArray(e))return;return e}{const e=Array.from(i).map(e=>r(e,{removeEmptyObjects:m,removeEmptyArrays:o,isRoot:!1})).filter(e=>!y.isUndefined(e));if(o&&t.isEmptyArray(e))return;return e}}if(a.isDate(i))return y.isNaN(i.getTime())?0:i.getTime();if(y.isObject(i)){const e={};for(const[t,s]of Object.entries(i)){const i=r(s,{removeEmptyObjects:m,removeEmptyArrays:o,isRoot:!1});y.isUndefined(i)||(e[t]=i)}return m&&t.isEmptyObject(e)?p?{}:void 0:e}}(r,{removeEmptyObjects:!!y.hasOwnProp(i,"removeEmptyObjects")&&i.removeEmptyObjects,removeEmptyArrays:!!y.hasOwnProp(i,"removeEmptyArrays")&&i.removeEmptyArrays,isRoot:!0})},exports.toStringDeep=function(r,i={}){return y.assertIsPlainObject(i,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`}),function r(i,s){if(y.isNil(i))return;const{removeEmptyArrays:n,removeEmptyObjects:o,isRoot:m}=s;if(!y.isBoolean(o)||!y.isBoolean(n))throw new TypeError(`Parameters \`removeEmptyObjects\` and \`removeEmptyArrays\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: ['removeEmptyObjects': \`${y.getPreciseType(o)}\`, 'removeEmptyArrays': \`${y.getPreciseType(n)}\`].`);if(y.isNumber(i)||y.isString(i))return String(i);if(a.isDate(i))return i.toISOString();if(t.isRegExp(i))return i.toString();if(y.isBuffer(i))return Array.from(i).map(e=>String(e)).filter(e=>!y.isUndefined(e));if(e.isTypedArray(i)){if(i instanceof BigInt64Array||i instanceof BigUint64Array){const e=Array.from(i).map(e=>r(e,{removeEmptyObjects:o,removeEmptyArrays:n,isRoot:!1})).map(e=>String(e)).filter(e=>!y.isUndefined(e));if(n&&t.isEmptyArray(e))return;return e}{const e=Array.from(i).map(e=>r(e,{removeEmptyObjects:o,removeEmptyArrays:n,isRoot:!1})).map(e=>String(e)).filter(e=>!y.isUndefined(e));if(n&&t.isEmptyArray(e))return;return e}}if(y.isSet(i)){const e=Array.from(i).map(e=>r(e,{removeEmptyObjects:o,removeEmptyArrays:n,isRoot:!1})).filter(e=>!y.isUndefined(e));if(n&&t.isEmptyArray(e))return;return e}if(a.isMap(i)){const e=Array.from(i.entries()).map(([e,t])=>[r(e,{removeEmptyObjects:o,removeEmptyArrays:n,isRoot:!1}),r(t,{removeEmptyObjects:o,removeEmptyArrays:n,isRoot:!1})]).filter(([e,r])=>!y.isUndefined(e)&&!y.isUndefined(r));if(n&&t.isEmptyArray(e))return;return e}if(y.isArray(i)){let e=i.map(e=>r(e,{removeEmptyObjects:o,removeEmptyArrays:n,isRoot:!1})).filter(e=>!y.isUndefined(e));if(n&&(e=e.filter(e=>!(y.isArray(e)&&0===e.length))),n&&t.isEmptyArray(e))return;return e}if(y.isObject(i)){const e={};for(const[t,s]of Object.entries(i)){const i=r(s,{removeEmptyObjects:o,removeEmptyArrays:n,isRoot:!1});y.isUndefined(i)?y.isArray(s)&&!n&&(e[t]=[]):e[t]=i}return o&&0===Object.keys(e).length?m?{}:void 0:e}}(r,{removeEmptyObjects:!!y.hasOwnProp(i,"removeEmptyObjects")&&i.removeEmptyObjects,removeEmptyArrays:!!y.hasOwnProp(i,"removeEmptyArrays")&&i.removeEmptyArrays,isRoot:!0})};
|
package/dist/chunk-EKS4IZJR.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("./chunk-EOZKYR5S.cjs"),r=require("./chunk-JARPXKBM.cjs"),t=require("./chunk-VHAPTHEA.cjs"),s=require("./chunk-ZHV5ZYVN.cjs"),i=require("./chunk-D3VSHABU.cjs"),n=e=>{t.assertIsArray(e,{message:({currentType:e,validType:r})=>`First parameter (\`values\`) must be of type \`${r}\` (array literal or instance), but received: \`${e}\`.`});const s=[];return e.forEach((t,i)=>{for(let n=i+1;n<e.length;n++)if(r.isEqual(t,e[n])){s.some(e=>r.isEqual(e,t))||s.push(t);break}}),s};exports.findDuplicates=n,exports.omitKeys=(e,r)=>{if(!i.isPlainObject(e))return{};t.assertIsArray(r,{message:({currentType:e,validType:r})=>`Second parameter (\`keysToOmit\`) must be of type \`${r}\` (array literal or instance), but received: \`${e}\`.`});const s=n(r);if(s.length>0)throw new Error(`Function "omitKeys" Error: Duplicate keys detected - \`${s}\``);return Object.fromEntries(Object.entries(e).filter(([e])=>!r.includes(e)))},exports.omitKeysDeep=(a,c)=>{if(!i.isPlainObject(a))return{};t.assertIsArray(c,{message:({currentType:e,validType:r})=>`Second parameter (\`keysToOmit\`) must be of type \`${r}\` (array literal or instance), but received: \`${e}\`.`});const o=n(c);if(i.isNonEmptyArray(o))throw new Error(`Function "omitKeysDeep" Error: Duplicate keys detected - \`${s.safeStableStringify(o)}\`.`);const u=(e,t)=>{if(!i.isObjectOrArray(e))return e;const[s,...n]=t;if(r.isEmptyArray(n))if(i.isArray(e)){const r=parseInt(s);!i.isNaN(r)&&r in e&&e.splice(r,1)}else delete e[s];else{const r=e[s];i.isObjectOrArray(r)&&(e[s]=u(r,n))}return e},y=e=>{if(i.isArray(e))return e.map(y).filter(e=>!(i.isObjectOrArray(e)&&0===Object.keys(e).length));if(i.isObjectOrArray(e)){return Object.fromEntries(Object.entries(e).map(([e,r])=>[e,y(r)]).filter(([,e])=>!(i.isUndefined(e)||i.isObjectOrArray(e)&&0===Object.keys(e).length)))}return e},l=e.safeJsonParse(s.safeStableStringify(a));for(const e of c){const r=e.split(".");u(l,r)}return y(l)};
|
package/dist/chunk-EOZKYR5S.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("./chunk-JARPXKBM.cjs"),r=require("./chunk-5C2SMIGX.cjs"),t=require("./chunk-ZHV5ZYVN.cjs"),o=require("./chunk-D3VSHABU.cjs"),n=e=>{if(!o.isString(e)&&!o.isNumber(e))return 0;const r=String(e).trim().replace(/[^0-9]/g,"");return Number(r)||0},s=(e={})=>{o.assertIsPlainObject(e,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const t=!!o.hasOwnProp(e,"convertBooleans")&&e.convertBooleans,n=!!o.hasOwnProp(e,"convertDates")&&e.convertDates,s=!!o.hasOwnProp(e,"convertNumbers")&&e.convertNumbers,i=!!o.hasOwnProp(e,"loggingOnFail")&&e.loggingOnFail,a=!!o.hasOwnProp(e,"removeEmptyArrays")&&e.removeEmptyArrays,c=!!o.hasOwnProp(e,"removeEmptyObjects")&&e.removeEmptyObjects,l=!!o.hasOwnProp(e,"removeNulls")&&e.removeNulls,u=!!o.hasOwnProp(e,"removeUndefined")&&e.removeUndefined,m=!!o.hasOwnProp(e,"strictMode")&&e.strictMode,p=!!o.hasOwnProp(e,"checkSymbols")&&e.checkSymbols,N=!!o.hasOwnProp(e,"convertNaN")&&e.convertNaN,v=o.hasOwnProp(e,"customDateFormats")?e.customDateFormats:[],d=o.hasOwnProp(e,"onError")?e.onError:r.noop;if(!(o.isBoolean(t)&&o.isBoolean(n)&&o.isBoolean(s)&&o.isBoolean(N)&&o.isBoolean(p)&&o.isBoolean(i)&&o.isBoolean(a)&&o.isBoolean(c)&&o.isBoolean(l)&&o.isBoolean(u)&&o.isBoolean(m)&&o.isArray(v)&&o.isFunction(d)))throw new TypeError(`Invalid \`options\` parameter (second argument): \`convertBooleans\`, \`convertDates\`, \`convertNumbers\`, \`loggingOnFail\`, \`removeEmptyArrays\`, \`removeEmptyObjects\`, \`removeNulls\`, \`removeUndefined\`, \`strictMode\` expected to be a \`boolean\` type, \`customDateFormats\` expected to be a \`array\` type and \`onError\` expected to be a \`void function\` type. But received: ['convertBooleans': \`${o.getPreciseType(t)}\`, 'convertDates': \`${o.getPreciseType(n)}\`, 'convertNumbers': \`${o.getPreciseType(s)}\`, 'loggingOnFail': \`${o.getPreciseType(i)}\`, 'removeEmptyArrays': \`${o.getPreciseType(a)}\`, 'removeEmptyObjects': \`${o.getPreciseType(c)}\`, 'removeNulls': \`${o.getPreciseType(l)}\`, 'removeUndefined': \`${o.getPreciseType(u)}\`, 'strictMode': \`${o.getPreciseType(m)}\`, 'customDateFormats': \`${o.getPreciseType(v)}\`, 'onError': \`${o.getPreciseType(d)}\`].`);return{convertBooleans:t,convertDates:n,convertNumbers:s,convertNaN:N,loggingOnFail:i,removeEmptyArrays:a,removeEmptyObjects:c,removeNulls:l,removeUndefined:u,strictMode:m,customDateFormats:v,onError:d,checkSymbols:p}},i=(r,t={})=>{var n;const c=s(t);if(o.isNull(r))return c.removeNulls?void 0:null;if(!o.isUndefined(r)){if(o.isString(r)){const e=r.trim();if(c.convertNaN&&"NaN"===e)return NaN;if(c.convertNumbers&&!o.isNaN(Number(e)))return Number(e);if(c.convertBooleans){if("true"===e)return!0;if("false"===e)return!1}if(c.convertDates){if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(e))return new Date(e);if(null==(n=c.customDateFormats)?void 0:n.length)for(const r of c.customDateFormats){const t=a(e,r);if(t)return t}}return c.strictMode?void 0:e}if(o.isArray(r)){const t=r.map(e=>i(e,c)).filter(e=>!o.isUndefined(e));return c.removeEmptyArrays&&e.isEmptyArray(t)?void 0:t}if(o.isObject(r)){const t={};for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e)){const n=i(r[e],c);o.isUndefined(n)||(t[e]=n)}return c.removeEmptyObjects&&e.isEmptyObject(t,{checkSymbols:c.checkSymbols})?void 0:t}return c.strictMode?void 0:r}c.removeUndefined},a=(e,r)=>{if(!o.isNonEmptyString(e)||!o.isNonEmptyString(r))throw new TypeError(`Parameter \`dateString\` and \`format\` must be of type \`string\` and not empty-string, but received: "['dateString': \`${o.getPreciseType(e)}\` - (current value: \`${t.safeStableStringify(e)}\`), 'format': \`${o.getPreciseType(r)}\` - (current value: \`${t.safeStableStringify(r)}\`)]".`);const n=e.split(/[-/]/).map(Number);if(3!==n.length||n.some(o.isNaN))return null;let s,i,a;if("DD/MM/YYYY"===r)[s,i,a]=n;else{if("MM/DD/YYYY"!==r)return null;[i,s,a]=n}i-=1;const c=new Date(a,i,s);return c.getFullYear()!==a||c.getMonth()!==i||c.getDate()!==s?null:c};exports.cleanParsedData=i,exports.extractDigits=n,exports.parseCustomDate=a,exports.safeJsonParse=function(e,r={}){if(o.isNull(e))return null;const t=s(r);if(t.convertNaN&&(o.isNaN(e)||o.isNonEmptyString(e)&&"NaN"===e))return NaN;if(t.convertNumbers&&!o.isNaN(Number(e))&&o.isNumber(n(e)))return Number(e);if(o.isString(e))try{let r=function(e){const r=new Set(["\\",'"',"/","b","f","n","r","t","u"]);let t="",o=!1,n=!1,s=!1;for(let i=0;i<e.length;i++){const a=e[i];if(s)o?"'"===a?t+="'":r.has(a)?t+="\\"===a?"\\\\":'"'===a?'\\"':"\\"+a:t+="\\\\"+a:n?'"'===a?t+='\\"':r.has(a)?t+="\\"+a:t+="\\\\"+a:t+="\\"+a,s=!1;else if("\\"!==a){if(o||n){if(o){if("'"===a){t+='"',o=!1;continue}}else if(n&&'"'===a){t+='"',n=!1;continue}}else{if("'"===a){t+='"',o=!0;continue}if('"'===a){t+='"',n=!0;continue}}t+=a}else s=!0}return t}(e);r=t.removeUndefined?r.replace(/,\s*"[^"]*"\s*:\s*undefined(?=\s*[},])/g,"").replace(/"[^"]*"\s*:\s*undefined\s*(,)?/g,""):r.replace(/:\s*undefined(?=\s*[,}])/g,":null"),r=t.convertNaN?r.replace(/:\s*NaN(?=\s*[,}])/g,':"NaN"'):r.replace(/:\s*NaN(?=\s*[,}])/g,':"NaN"').replace(/,\s*"[^"]*"\s*:\s*NaN(?=\s*[},])/g,"").replace(/"[^"]*"\s*:\s*NaN\s*(,)?/g,""),r=r.replace(/,(\s*[}\]])/g,"$1");const o=JSON.parse(r);return i(o,t)}catch(e){return t.loggingOnFail&&console.error("Failed to parsing at `safeJsonParse`:",e),void t.onError(o.isError(e)?new Error(e.message.replace(/^JSON\.parse:/,"Failed to parsing")):new Error(String(e)))}};
|
package/dist/chunk-EW3I4O7X.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=e=>"boolean"==typeof e,r=e=>"function"==typeof e;function t(e){return null==e}function o(e){return Array.isArray(e)}function a(e){return"object"==typeof e&&!t(e)&&!o(e)}function n(e){if(!a(e))return!1;const r=Object.getPrototypeOf(e);return r===Object.prototype||null===r}var i=e=>"string"==typeof e;function s(e){return"number"==typeof e?Number.isNaN(e):"[object Number]"===Object.prototype.toString.call(e)&&Number.isNaN(Number(e).valueOf())}var l=e=>null===e,c=(r,t={})=>{if(e(r))return;const o=D({value:r,options:t,requiredValidType:"boolean"});throw new TypeError(o)},u=(r,t={})=>{x(t,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const o=!(!n(t)||!e(t.includeNaN))&&t.includeNaN;c(o,{message:({currentType:e,validType:r})=>`Parameter \`includeNaN\` property of the \`options\` (second parameter) must be of type \`${r}\`, but received: \`${e}\`.`});const a="number"==typeof r;return o?a:a&&!Number.isNaN(r)},f=e=>"symbol"==typeof e,m=e=>void 0===e;function p(e){return o(e)||a(e)}function y(e,t,o={}){if(!i(e)&&!p(e)&&!r(e))return!1;x(o,{message:({currentType:e,validType:r})=>`Third parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const a=void 0===o.discardUndefined||o.discardUndefined,n=void 0!==o.discardNull&&o.discardNull;c(a,{message:({currentType:e,validType:r})=>`Parameter \`discardUndefined\` property of the \`options\` (third parameter) must be of type \`${r}\`, but received: \`${e}\`.`}),c(n,{message:({currentType:e,validType:r})=>`Parameter \`discardNull\` property of the \`options\` (third parameter) must be of type \`${r}\`, but received: \`${e}\`.`});const y=[];if(i(t)&&t.trim().length>0||u(t,{includeNaN:!0})){(u(t,{includeNaN:!0})?String(t):t).split(".").forEach(e=>{const r=e.match(/^\[(\d+)\]$/),t=e.match(/^Symbol\((.+)\)$/);r?y.push(Number(r[1])):t?y.push(Symbol.for(t[1])):s(Number(e))?y.push(e):y.push(Number(e))})}else{if(!f(t))return!1;y.push(t)}let b=i(e)&&e.trim().length>0?Object(e):e;for(const e of y)if(i(e)&&e.trim().length>0||u(e,{includeNaN:!0})){if(l(b)||!Object.prototype.hasOwnProperty.call(b,e))return!1;b=b[e]}else{if(!f(e))return!1;{if(l(b)||"object"!=typeof b&&!r(b))return!1;const t=Object.getOwnPropertySymbols(b).find(r=>r===e||r.description===e.description);if(!t)return!1;b=b[t]}}return(!a||!m(b))&&(!n||!l(b))}var b=(e,r={})=>{if(!i(e))return!1;x(r,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const t=!y(r,"trim")||r.trim;c(t,{message:({currentType:e,validType:r})=>`Parameter \`trim\` property of the \`options\` (second parameter) must be of type \`${r}\`, but received: \`${e}\`.`});return(t?e.trim():e).length>0};function d(e){return"[object Set]"===Object.prototype.toString.call(e)||e instanceof Set}function g(e){return Array.isArray(e)&&e.length>0}var v=(e,r={lowerCaseNextRest:!0,trim:!1})=>{if(!b(e))return"";n(r)||(r={});const t=!1!==r.lowerCaseNextRest;return!0===r.trim&&(e=e.trim()),e[0].toUpperCase()+(t?e.slice(1).toLowerCase():e.slice(1))},h=(e,r={collapseSpaces:!1,trim:!1})=>{var t,o;if(!b(e))return"";let a=e;n(r)||(r={});const i=!0===r.collapseSpaces;if(!0===r.trim&&(a=a.trim()),i){const e=(null==(t=a.match(/^\s*/))?void 0:t[0])??"",r=(null==(o=a.match(/\s*$/))?void 0:o[0])??"";a=a.trim().replace(/\s+/g," "),a=`${e}${a}${r}`}return a.toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")},j=e=>{let r="";return o(e)?r=e.map(e=>b(e)?e.trim():"").filter(e=>e.length).join("-"):b(e)&&(r=e.trim()),r.split(/[^\p{L}\p{N}]+/u).filter(Boolean)},S=e=>{const r=new Set([]),t=e=>e.trim().split(/[^\p{L}\p{N}]+/u).filter(Boolean).join("");if(b(e)){const o=t(e);o&&r.add(o)}return g(e)&&e.forEach(e=>{if(b(e)){const o=t(e);o&&r.add(o)}}),d(e)&&e.forEach(e=>{if(b(e)){const o=t(e);o&&r.add(o)}}),r},C=(e,r)=>{if(!g(e)&&!b(e))return"";const t=j(e),o=S(r);return t.map((e,r)=>o.has(e)?e:0===r?e.toLowerCase():e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join("")},N=(e,r)=>{if(!g(e)&&!b(e))return"";const t=j(e),o=S(r);return t.map(e=>o.has(e)?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")},w=(e,r)=>{if(!g(e)&&!b(e))return"";const t=j(e),o=S(r);return t.map(e=>o.has(e)?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join("")},T=(e,r)=>{if(!g(e)&&!b(e))return"";const t=j(e),o=S(r);return t.map(e=>o.has(e)?e:e.toLowerCase()).join(" ")},A=(e,r)=>{if(!g(e)&&!b(e))return"";const t=j(e),o=S(r);return t.map(e=>o.has(e)?e:e.toLowerCase()).join("-")},P=(e,r)=>{if(!g(e)&&!b(e))return"";const t=j(e),o=S(r);return t.map(e=>o.has(e)?e:e.toLowerCase()).join("_")},R=(e,r)=>{if(!g(e)&&!b(e))return"";const t=j(e),o=S(r);return t.map(e=>o.has(e)?e:e.toLowerCase()).join(".")},I=(e,r)=>{if(!g(e)&&!b(e))return"";const t=j(e),o=S(r);return t.map(e=>o.has(e)?e:e.toLowerCase()).join("-").replace(/^-+|-+$/g,"")},L=e=>"[object Error]"===Object.prototype.toString.call(e)||e instanceof Error,O=e=>"undefined"!=typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(e),E=Object.freeze(["URI","URL","HTTP","HTTPS","HTML","XML","CSS","JS","JSON","SVG","DOM","UTC","XHR","RTC","ICE","TLS","TCP","UDP","IDB","ID"]),$=e=>e.replace(/[\s_\-]+/g,"").toLowerCase(),U=Object.entries({string:"String",number:"Number",boolean:"Boolean",bigint:"Big Int",symbol:"Symbol",undefined:"Undefined",null:"Null",regexp:"Reg Exp",reflect:"Reflect",proxy:"Proxy",atomics:"Atomics",object:"Object",array:"Array",arguments:"Arguments",function:"Function",asyncfunction:"Async Function",generatorfunction:"Generator Function",asyncgeneratorfunction:"Async Generator Function",generator:"Generator",promise:"Promise",evalerror:"Eval Error",rangeerror:"Range Error",referenceerror:"Reference Error",syntaxerror:"Syntax Error",typeerror:"Type Error",urierror:"URI Error",aggregateerror:"Aggregate Error",error:"Error",int8array:"Int 8 Array",uint8array:"Uint 8 Array",uint8clampedarray:"Uint 8 Clamped Array",int16array:"Int 16 Array",uint16array:"Uint 16 Array",int32array:"Int 32 Array",uint32array:"Uint 32 Array",float32array:"Float 32 Array",float64array:"Float 64 Array",bigint64array:"Big Int 64 Array",biguint64array:"Big Uint 64 Array",arraybuffer:"Array Buffer",sharedarraybuffer:"Shared Array Buffer",dataview:"Data View",arraybufferview:"Array Buffer View",map:"Map",set:"Set",weakmap:"Weak Map",weakset:"Weak Set",mapiterator:"Map Iterator",setiterator:"Set Iterator",arrayiterator:"Array Iterator",stringiterator:"String Iterator",readablestream:"Readable Stream",writablestream:"Writable Stream",transformstream:"Transform Stream",readablestreamdefaultreader:"Readable Stream Default Reader",writablestreamdefaultwriter:"Writable Stream Default Writer",readablestreamdefaultcontroller:"Readable Stream Default Controller",transformstreamdefaultcontroller:"Transform Stream Default Controller",abortcontroller:"Abort Controller",abortsignal:"Abort Signal",fetch:"fetch",request:"Request",response:"Response",headers:"Headers",formdata:"FormData",blob:"Blob",file:"File",filelist:"FileList",filereader:"FileReader",intl:"Intl",collator:"Intl. Collator",datetimeformat:"Intl. Date Time Format",listformat:"Intl. List Format",numberformat:"Intl. Number Format",pluralrules:"Intl. Plural Rules",relativetimeformat:"Intl. Relative Time Format",segmenter:"Intl. Segmenter",locale:"Intl. Locale",displaynames:"Intl. Display Names",finalizationregistry:"Finalization Registry",weakref:"Weak Ref",structuredclone:"structured Clone",urlpattern:"URL Pattern",performance:"Performance",performanceobserver:"Performance Observer",performanceentry:"Performance Entry",performancemark:"Performance Mark",performancemeasure:"Performance Measure",webassembly:"Web Assembly",wasmmodule:"WebAssembly .Module",wasminstance:"WebAssembly. Instance",wasmmemory:"WebAssembly. Memory",wasmtable:"WebAssembly. Table",buffer:"Buffer",process:"Process",eventemitter:"Event Emitter",stream:"Stream",fs:"fs",path:"path",url:"URL",urlsearchparams:"URL Search Params",node:"Node",element:"Element",htmlelement:"HTML Element",svgelement:"SVG Element",document:"Document",documentfragment:"Document Fragment",shadowroot:"Shadow Root",nodelist:"Node List",htmlcollection:"HTML Collection",mutationobserver:"Mutation Observer",intersectionobserver:"Intersection Observer",resizeobserver:"Resize Observer"}).reduce((e,[r,t])=>(e[$(r)]=t,e),{});var B=(e,r)=>"toPascalCaseSpace"===r?N(e,E):"slugify"===r?I(e,E):"toCamelCase"===r?C(e,E):"toDotCase"===r?R(e,E):"toKebabCase"===r?A(e,E):"toPascalCase"===r?w(e,E):"toSnakeCase"===r?P(e,E):T(e,E),F=(e,t={formatCase:"toLowerCase"})=>{var o,i;n(t)||(t={});const c=t.formatCase;if(l(e))return B(U[$("null")]??"Null",c);if(s(e))return"NaN";if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(e instanceof Number)return B("Number Constructor",c);if(e instanceof String)return B("String Constructor",c);if(e instanceof Boolean)return B("Boolean Constructor",c);const u=typeof e;if(!p(e)&&!r(e))return B(U[$(u)]??u,c);if(O(e))return B(U[$("buffer")]??"Buffer",c);if(function(e){if("object"!=typeof e||null===e)return!1;const r=Object.prototype.toString.call(e);if(["[object Array]","[object Date]","[object RegExp]","[object Map]","[object Set]","[object WeakMap]","[object WeakSet]","[object Function]","[object Error]","[object Promise]","[object Generator]","[object GeneratorFunction]","[object AsyncFunction]"].includes(r))return!1;try{return Reflect.defineProperty(e,"__proxy_detect__",{configurable:!0,value:1}),Reflect.deleteProperty(e,"__proxy_detect__"),!1}catch{return!0}}(e))return B(U[$("proxy")]??"Proxy",c);if(a(e)&&r(null==e?void 0:e.next)&&r(null==e?void 0:e.throw))return B(U[$("generator")]??"Generator",c);if(L(e)){const r=(null==(o=e.constructor)?void 0:o.name)??"Error";return B(U[$(r)]??U[$(r.replace(/\s+/g,""))]??r,c)}if(l(Object.getPrototypeOf(e)))return B(U[$("object")]??"Object",c);const f=Object.prototype.toString.call(e).slice(8,-1)||"Object",m=U[$(f)];if(m)return B(m,c);const y=null==(i=null==e?void 0:e.constructor)?void 0:i.name;return B(y&&"Object"!==y?U[$(y)]??y:f,c)};function D(e){const{requiredValidType:t,value:o,options:a}=e||{},{message:i,formatCase:s}=n(a)?a:{},l=A(t),c=F(o,{formatCase:s}),u={currentType:c,validType:l},f=`Parameter input (\`value\`) must be of type \`${l}\`, but received: \`${c}\`.`;return r(i)?b(i(u))?i(u).trim():f:b(i)?i.trim():f}function x(e,r={}){if(n(e))return;const t=D({value:e,options:r,requiredValidType:"plain object"});throw new TypeError(t)}export{c as assertIsBoolean,x as assertIsPlainObject,v as capitalizeFirst,h as capitalizeWords,F as getPreciseType,y as hasOwnProp,o as isArray,e as isBoolean,O as isBuffer,L as isError,r as isFunction,s as isNaN,t as isNil,g as isNonEmptyArray,b as isNonEmptyString,l as isNull,u as isNumber,a as isObject,p as isObjectOrArray,n as isPlainObject,d as isSet,i as isString,f as isSymbol,m as isUndefined,D as resolveErrorMessageAssertions,I as slugify,C as toCamelCase,R as toDotCase,A as toKebabCase,T as toLowerCase,w as toPascalCase,N as toPascalCaseSpace,P as toSnakeCase};
|
package/dist/chunk-F3E77L46.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{assertIsArray as e}from"./chunk-ECRNH4FW.js";import{isPlainObject as i,isNumber as r,isNonEmptyString as s,isFunction as o,hasOwnProp as t,isNonEmptyArray as n,getPreciseType as a}from"./chunk-EW3I4O7X.js";import{getDefaultConfig as l,extendTailwindMerge as c}from"tailwind-merge-v3";import{getDefaultConfig as f,extendTailwindMerge as p}from"tailwind-merge-v4";function d(e){var i,r,s="";if("string"==typeof e||"number"==typeof e)s+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(i=0;i<o;i++)e[i]&&(r=d(e[i]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}var u=function(){for(var e,i,r=0,s="",o=arguments.length;r<o;r++)(e=arguments[r])&&(i=d(e))&&(s&&(s+=" "),s+=i);return s},m=e=>{i(e)||(e={});let{config:a,prefix:l,extend:c,override:f,cacheSize:p,experimentalParseClassName:d}=e;i(a)||(a={}),i(c)||(c={}),i(f)||(f={}),r(p)||(p=void 0),s(l)||(l=void 0),o(d)||(d=void 0);return{config:a,override:f,cacheSize:p,prefix:l,experimentalParseClassName:d,theme:t(c,"theme")?c.theme:{},classGroups:t(c,"classGroups")?c.classGroups:{},conflictingClassGroupModifiers:t(c,"conflictingClassGroupModifiers")?c.conflictingClassGroupModifiers:{},conflictingClassGroups:t(c,"conflictingClassGroups")?c.conflictingClassGroups:{},orderSensitiveModifiers:t(c,"orderSensitiveModifiers")&&n(c.orderSensitiveModifiers)?c.orderSensitiveModifiers:[]}},g=l(),v=(e={})=>{var r,s,o;i(e)||(e={});const{cacheSize:t,classGroups:n,config:a,conflictingClassGroupModifiers:l,conflictingClassGroups:f,override:p,prefix:d,theme:u,experimentalParseClassName:v}=m(e);return c({prefix:d??a.prefix,cacheSize:t||g.cacheSize,experimentalParseClassName:v,override:p,extend:{conflictingClassGroupModifiers:{...g.conflictingClassGroupModifiers,...l},theme:{...g.theme,...u},conflictingClassGroups:{...g.conflictingClassGroups,...f},classGroups:{...g.classGroups,...n,"text-shadow":["","-sm","-md","-lg","-xl","-xxl","-none","-default"].map(e=>`text-shadow${e}`),"font-size":Object.keys({...(null==(r=a.theme)?void 0:r.fontSize)||{},...(null==(o=null==(s=a.theme)?void 0:s.extend)?void 0:o.fontSize)||{}}).map(e=>`text-${e}`)}}})},x=f(),h=(e={})=>{var r,s,o;i(e)||(e={});const{cacheSize:t,classGroups:n,config:a,conflictingClassGroupModifiers:l,conflictingClassGroups:c,orderSensitiveModifiers:f,override:d,prefix:u,theme:g,experimentalParseClassName:v}=m(e);return p({prefix:u||a.prefix,cacheSize:t||x.cacheSize,experimentalParseClassName:v,override:d,extend:{conflictingClassGroupModifiers:{...x.conflictingClassGroupModifiers,...l},theme:{...x.theme,...g},conflictingClassGroups:{...x.conflictingClassGroups,...c},orderSensitiveModifiers:[...x.orderSensitiveModifiers,...f],classGroups:{...x.classGroups,...n,"text-shadow":["","-sm","-md","-lg","-xl","-xxl","-none","-default"].map(e=>`text-shadow${e}`),"font-size":Object.keys({...(null==(r=a.theme)?void 0:r.fontSize)||{},...(null==(o=null==(s=a.theme)?void 0:s.extend)?void 0:o.fontSize)||{}}).map(e=>`text-${e}`)}}})},G=v(),C=h(),S=(...e)=>G(u(...e)),M=(...e)=>C(u(...e)),y=(e,...i)=>{if(!o(e))throw new TypeError(`first Parameter (\`customTwMergeV3\`) must be of type \`function\`, but received: \`${a(e)}\`.`);return e(u(...i))},z=(e,...i)=>{if(!o(e))throw new TypeError(`first Parameter (\`customTwMergeV4\`) must be of type \`function\`, but received: \`${a(e)}\`.`);return e(u(...i))},w=i=>(e(i,{message:({currentType:e,validType:i})=>`First parameter (\`props\`) must be of type \`${i}\`, but received: \`${e}\`.`}),e=>!i.map(e=>e.toString()).includes(e.toString()));export{S as cnV3,M as cnV4,y as customCnV3,z as customCnV4,w as shouldForwardProp,v as twMergeDefaultV3,h as twMergeDefaultV4};
|