@rzl-zone/utils-js 3.4.0 → 3.5.1
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 +1 -1
- package/README.md +94 -45
- package/dist/assertions/index.cjs +41 -1
- package/dist/assertions/index.d.ts +11 -2
- package/dist/assertions/index.js +14 -1
- package/dist/chunk-2CQX5CBG.js +262 -1
- package/dist/chunk-2IOOEY45.cjs +30 -1
- package/dist/chunk-2WA36TC5.cjs +189 -0
- package/dist/chunk-3IBQ5MOM.js +16 -1
- package/dist/chunk-3VA554KW.js +34 -1
- package/dist/chunk-5757UBXJ.cjs +157 -1
- package/dist/chunk-5IGC6PBH.js +33 -1
- package/dist/chunk-5KJFVIQT.cjs +65 -1
- package/dist/chunk-6JFCSH7J.js +35 -1
- package/dist/chunk-6JFZL7YE.cjs +24 -1
- package/dist/chunk-7ODAAXX5.cjs +397 -1
- package/dist/chunk-BAV5T2E3.cjs +15 -1
- package/dist/chunk-CAH33WOQ.cjs +36 -1
- package/dist/chunk-CDCERIZ2.js +177 -0
- package/dist/chunk-CKTLUNWX.js +22 -1
- package/dist/chunk-CMW2TBOQ.js +567 -1
- package/dist/chunk-D3ENH7H6.cjs +101 -1
- package/dist/chunk-DEZZUYE2.js +152 -1
- package/dist/chunk-DVMHRLKP.cjs +16 -1
- package/dist/chunk-DWF2R5GD.cjs +225 -1
- package/dist/chunk-E55EQK2U.cjs +18 -1
- package/dist/chunk-E74U6CYP.cjs +18 -1
- package/dist/chunk-EL6A35UR.cjs +64 -1
- package/dist/chunk-F6IPNNSJ.cjs +554 -1
- package/dist/chunk-FJZGG54N.cjs +267 -1
- package/dist/chunk-FWCKOJZM.js +542 -1
- package/dist/chunk-FWHNWL2P.cjs +419 -1
- package/dist/chunk-GGEADHZO.js +90 -1
- package/dist/chunk-GQR4R5WY.js +31 -1
- package/dist/chunk-H66AC7GK.cjs +93 -1
- package/dist/chunk-HQWOFR56.cjs +33 -1
- package/dist/chunk-HYRQMTRH.cjs +24 -1
- package/dist/chunk-IRFL4MAX.js +63 -1
- package/dist/chunk-IVL7CKVH.cjs +37 -1
- package/dist/chunk-IZPBKKPO.js +16 -1
- package/dist/chunk-JBQMXC5I.cjs +106 -1
- package/dist/chunk-JEQEF5WD.js +95 -1
- package/dist/chunk-JMJQCN74.js +370 -1
- package/dist/chunk-KHO2SBNA.cjs +16 -1
- package/dist/chunk-KVAL5PAG.cjs +26 -1
- package/dist/chunk-L5RDAVVH.js +14 -1
- package/dist/chunk-LS6U7FAY.cjs +110 -1
- package/dist/chunk-NBZWMBO6.js +101 -1
- package/dist/chunk-NRF6LWBC.cjs +56 -1
- package/dist/chunk-OI5XKNZO.js +53 -1
- package/dist/chunk-ONZFBJVW.js +14 -1
- package/dist/chunk-OYTYSY7G.js +106 -1
- package/dist/chunk-PET42Z7W.js +119 -1
- package/dist/chunk-PZQ6I4JJ.cjs +605 -1
- package/dist/chunk-QBKAEVYG.js +113 -1
- package/dist/chunk-QNKGP5DY.js +14 -1
- package/dist/chunk-RIPKY4RU.js +417 -1
- package/dist/chunk-RZW35UN5.cjs +116 -1
- package/dist/chunk-SBFNXGTJ.js +220 -1
- package/dist/chunk-SBKGWRS5.js +22 -1
- package/dist/chunk-SIM77PU4.js +59 -1
- package/dist/chunk-T2T7K3KR.js +28 -1
- package/dist/chunk-T7PU2V7X.cjs +123 -1
- package/dist/chunk-UDA26MCU.cjs +16 -1
- package/dist/chunk-V45XJKHW.cjs +18 -1
- package/dist/chunk-VJDDGRIK.cjs +16 -1
- package/dist/chunk-W2WNBUDE.js +16 -1
- package/dist/chunk-WVSPXFTY.js +14 -1
- package/dist/chunk-XABCB3Y7.cjs +582 -1
- package/dist/chunk-XEDXFSGI.js +24 -1
- package/dist/chunk-YKPSRP5G.js +571 -1
- package/dist/chunk-YWHHVDT4.js +13 -1
- package/dist/chunk-ZETAZZLD.cjs +38 -1
- package/dist/conversions/index.cjs +104 -1
- package/dist/conversions/index.d.ts +10 -1
- package/dist/conversions/index.js +25 -1
- package/dist/events/index.cjs +32 -1
- package/dist/events/index.d.ts +10 -1
- package/dist/events/index.js +13 -1
- package/dist/formatters/index.cjs +62 -1
- package/dist/formatters/index.d.ts +10 -1
- package/dist/formatters/index.js +19 -1
- package/dist/generators/index.cjs +38 -1
- package/dist/generators/index.d.ts +10 -1
- package/dist/generators/index.js +15 -1
- package/dist/index.d.ts +39 -12
- package/dist/{isPlainObject-CEPWPiXh.d.ts → isPlainObject-FWmcJF6k.d.ts} +13 -4
- package/dist/next/index.cjs +218 -1
- package/dist/next/index.d.ts +10 -1
- package/dist/next/index.js +213 -1
- package/dist/next/server/index.cjs +43 -1
- package/dist/next/server/index.d.ts +10 -1
- package/dist/next/server/index.js +41 -1
- package/dist/operations/index.cjs +33 -1
- package/dist/operations/index.d.ts +10 -1
- package/dist/operations/index.js +18 -1
- package/dist/parsers/index.cjs +18 -1
- package/dist/parsers/index.d.ts +10 -1
- package/dist/parsers/index.js +11 -1
- package/dist/predicates/index.cjs +299 -1
- package/dist/predicates/index.d.ts +13 -4
- package/dist/predicates/index.js +24 -1
- package/dist/promises/index.cjs +25 -1
- package/dist/promises/index.d.ts +10 -1
- package/dist/promises/index.js +14 -1
- package/dist/rzl-utils.global.js +25 -1
- package/dist/strings/index.cjs +82 -1
- package/dist/strings/index.d.ts +10 -1
- package/dist/strings/index.js +15 -1
- package/dist/tailwind/index.cjs +43 -1
- package/dist/tailwind/index.d.ts +10 -1
- package/dist/tailwind/index.js +12 -1
- package/dist/urls/index.cjs +51 -1
- package/dist/urls/index.d.ts +10 -1
- package/dist/urls/index.js +24 -1
- package/package.json +60 -179
- package/dist/chunk-JYQTCICM.js +0 -1
- package/dist/chunk-YLA3DURS.cjs +0 -1
package/dist/chunk-FWHNWL2P.cjs
CHANGED
|
@@ -1 +1,419 @@
|
|
|
1
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* ====================================================
|
|
3
|
+
* Rzl Utils-JS.
|
|
4
|
+
* ----------------------------------------------------
|
|
5
|
+
* Version: 3.5.1.
|
|
6
|
+
* Author: Rizalvin Dwiky.
|
|
7
|
+
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
|
+
* ====================================================
|
|
9
|
+
*/
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
var chunkPZQ6I4JJ_cjs = require('./chunk-PZQ6I4JJ.cjs');
|
|
13
|
+
|
|
14
|
+
var KNOWN_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
15
|
+
// 📄 Text & Document
|
|
16
|
+
"txt",
|
|
17
|
+
"md",
|
|
18
|
+
"rtf",
|
|
19
|
+
"tex",
|
|
20
|
+
"doc",
|
|
21
|
+
"docx",
|
|
22
|
+
"odt",
|
|
23
|
+
"ott",
|
|
24
|
+
"pdf",
|
|
25
|
+
"djvu",
|
|
26
|
+
"epub",
|
|
27
|
+
"mobi",
|
|
28
|
+
"azw",
|
|
29
|
+
"azw3",
|
|
30
|
+
"xls",
|
|
31
|
+
"xlsx",
|
|
32
|
+
"ods",
|
|
33
|
+
"csv",
|
|
34
|
+
"tsv",
|
|
35
|
+
"ppt",
|
|
36
|
+
"pptx",
|
|
37
|
+
"odp",
|
|
38
|
+
"pps",
|
|
39
|
+
"md",
|
|
40
|
+
"bib",
|
|
41
|
+
"tex",
|
|
42
|
+
"log",
|
|
43
|
+
// 🖼️ Image
|
|
44
|
+
"jpg",
|
|
45
|
+
"jpeg",
|
|
46
|
+
"png",
|
|
47
|
+
"gif",
|
|
48
|
+
"bmp",
|
|
49
|
+
"tif",
|
|
50
|
+
"tiff",
|
|
51
|
+
"webp",
|
|
52
|
+
"svg",
|
|
53
|
+
"ico",
|
|
54
|
+
"heif",
|
|
55
|
+
"heic",
|
|
56
|
+
"raw",
|
|
57
|
+
"cr2",
|
|
58
|
+
"nef",
|
|
59
|
+
"orf",
|
|
60
|
+
"sr2",
|
|
61
|
+
"dng",
|
|
62
|
+
"dds",
|
|
63
|
+
"psd",
|
|
64
|
+
"exr",
|
|
65
|
+
"xcf",
|
|
66
|
+
"ai",
|
|
67
|
+
"eps",
|
|
68
|
+
"cdr",
|
|
69
|
+
"psd",
|
|
70
|
+
"indd",
|
|
71
|
+
// 🎵 Audio
|
|
72
|
+
"mp3",
|
|
73
|
+
"wav",
|
|
74
|
+
"ogg",
|
|
75
|
+
"flac",
|
|
76
|
+
"aac",
|
|
77
|
+
"m4a",
|
|
78
|
+
"wma",
|
|
79
|
+
"alac",
|
|
80
|
+
"aiff",
|
|
81
|
+
"amr",
|
|
82
|
+
"mid",
|
|
83
|
+
"midi",
|
|
84
|
+
"opus",
|
|
85
|
+
"au",
|
|
86
|
+
"caf",
|
|
87
|
+
"ape",
|
|
88
|
+
"opus",
|
|
89
|
+
// 🎥 Video
|
|
90
|
+
"mp4",
|
|
91
|
+
"mkv",
|
|
92
|
+
"avi",
|
|
93
|
+
"mov",
|
|
94
|
+
"flv",
|
|
95
|
+
"wmv",
|
|
96
|
+
"webm",
|
|
97
|
+
"mpeg",
|
|
98
|
+
"mpg",
|
|
99
|
+
"3gp",
|
|
100
|
+
"3g2",
|
|
101
|
+
"m4v",
|
|
102
|
+
"ts",
|
|
103
|
+
"mts",
|
|
104
|
+
"asf",
|
|
105
|
+
"rm",
|
|
106
|
+
"rmvb",
|
|
107
|
+
"vob",
|
|
108
|
+
"f4v",
|
|
109
|
+
"ogv",
|
|
110
|
+
"m2ts",
|
|
111
|
+
"mod",
|
|
112
|
+
"dav",
|
|
113
|
+
// 🗃️ Archive & Compression
|
|
114
|
+
"zip",
|
|
115
|
+
"rar",
|
|
116
|
+
"7z",
|
|
117
|
+
"tar",
|
|
118
|
+
"gz",
|
|
119
|
+
"bz2",
|
|
120
|
+
"xz",
|
|
121
|
+
"tgz",
|
|
122
|
+
"tbz2",
|
|
123
|
+
"txz",
|
|
124
|
+
"lz",
|
|
125
|
+
"lzma",
|
|
126
|
+
"z",
|
|
127
|
+
"cab",
|
|
128
|
+
"arj",
|
|
129
|
+
"ace",
|
|
130
|
+
"iso",
|
|
131
|
+
"dmg",
|
|
132
|
+
"rpm",
|
|
133
|
+
"deb",
|
|
134
|
+
"pkg",
|
|
135
|
+
"apk",
|
|
136
|
+
"jar",
|
|
137
|
+
// 💾 Disk Image
|
|
138
|
+
"iso",
|
|
139
|
+
"img",
|
|
140
|
+
"vhd",
|
|
141
|
+
"vmdk",
|
|
142
|
+
"qcow2",
|
|
143
|
+
"dmg",
|
|
144
|
+
// 🗃️ Database & Data
|
|
145
|
+
"sql",
|
|
146
|
+
"db",
|
|
147
|
+
"dbf",
|
|
148
|
+
"mdb",
|
|
149
|
+
"accdb",
|
|
150
|
+
"json",
|
|
151
|
+
"xml",
|
|
152
|
+
"yaml",
|
|
153
|
+
"yml",
|
|
154
|
+
"toml",
|
|
155
|
+
"ini",
|
|
156
|
+
"plist",
|
|
157
|
+
"yaml",
|
|
158
|
+
"pkl",
|
|
159
|
+
"msgpack",
|
|
160
|
+
"h5",
|
|
161
|
+
"hdf5",
|
|
162
|
+
"parquet",
|
|
163
|
+
"avro",
|
|
164
|
+
"orc",
|
|
165
|
+
"ndjson",
|
|
166
|
+
"db",
|
|
167
|
+
"pdb",
|
|
168
|
+
"sqlite",
|
|
169
|
+
"sqlite3",
|
|
170
|
+
"dbx",
|
|
171
|
+
"sdf",
|
|
172
|
+
// 💻 Code & Script
|
|
173
|
+
"js",
|
|
174
|
+
"jsx",
|
|
175
|
+
"ts",
|
|
176
|
+
"tsx",
|
|
177
|
+
"c",
|
|
178
|
+
"cpp",
|
|
179
|
+
"h",
|
|
180
|
+
"hpp",
|
|
181
|
+
"java",
|
|
182
|
+
"py",
|
|
183
|
+
"rb",
|
|
184
|
+
"go",
|
|
185
|
+
"rs",
|
|
186
|
+
"php",
|
|
187
|
+
"pl",
|
|
188
|
+
"sh",
|
|
189
|
+
"bat",
|
|
190
|
+
"cmd",
|
|
191
|
+
"ps1",
|
|
192
|
+
"lua",
|
|
193
|
+
"swift",
|
|
194
|
+
"kt",
|
|
195
|
+
"scala",
|
|
196
|
+
"cs",
|
|
197
|
+
"vb",
|
|
198
|
+
"dart",
|
|
199
|
+
"m",
|
|
200
|
+
"r",
|
|
201
|
+
"jl",
|
|
202
|
+
"fs",
|
|
203
|
+
"vbproj",
|
|
204
|
+
"sln",
|
|
205
|
+
"pri",
|
|
206
|
+
"Makefile",
|
|
207
|
+
// 🌐 Web & Config
|
|
208
|
+
"html",
|
|
209
|
+
"htm",
|
|
210
|
+
"xhtml",
|
|
211
|
+
"css",
|
|
212
|
+
"scss",
|
|
213
|
+
"sass",
|
|
214
|
+
"less",
|
|
215
|
+
"xml",
|
|
216
|
+
"json",
|
|
217
|
+
"yaml",
|
|
218
|
+
"yml",
|
|
219
|
+
"xlf",
|
|
220
|
+
"xlf",
|
|
221
|
+
"po",
|
|
222
|
+
"pot",
|
|
223
|
+
"jsp",
|
|
224
|
+
"asp",
|
|
225
|
+
"aspx",
|
|
226
|
+
"php",
|
|
227
|
+
"jspf",
|
|
228
|
+
"cgi",
|
|
229
|
+
"cfm",
|
|
230
|
+
"pl",
|
|
231
|
+
"env",
|
|
232
|
+
"conf",
|
|
233
|
+
"config",
|
|
234
|
+
"xml",
|
|
235
|
+
"ini",
|
|
236
|
+
"cfg",
|
|
237
|
+
"toml",
|
|
238
|
+
"yaml",
|
|
239
|
+
"dockerfile",
|
|
240
|
+
"gitignore",
|
|
241
|
+
"gitconfig",
|
|
242
|
+
"gitattributes",
|
|
243
|
+
"npmignore",
|
|
244
|
+
"lock",
|
|
245
|
+
"gradle",
|
|
246
|
+
"pom",
|
|
247
|
+
"yaml",
|
|
248
|
+
"prettierrc",
|
|
249
|
+
"eslintrc",
|
|
250
|
+
"babelrc",
|
|
251
|
+
"editorconfig",
|
|
252
|
+
// 🔠 Font
|
|
253
|
+
"ttf",
|
|
254
|
+
"otf",
|
|
255
|
+
"woff",
|
|
256
|
+
"woff2",
|
|
257
|
+
"eot",
|
|
258
|
+
// 🗺️ CAD & GIS
|
|
259
|
+
"dwg",
|
|
260
|
+
"dxf",
|
|
261
|
+
"shp",
|
|
262
|
+
"kml",
|
|
263
|
+
"kmz",
|
|
264
|
+
"gpx",
|
|
265
|
+
"stl",
|
|
266
|
+
"step",
|
|
267
|
+
"iges",
|
|
268
|
+
"3ds",
|
|
269
|
+
"3dm",
|
|
270
|
+
"fbx",
|
|
271
|
+
"obj",
|
|
272
|
+
// 🔧 System / Binary / Execution
|
|
273
|
+
"exe",
|
|
274
|
+
"msi",
|
|
275
|
+
"bin",
|
|
276
|
+
"run",
|
|
277
|
+
"com",
|
|
278
|
+
"cmd",
|
|
279
|
+
"apk",
|
|
280
|
+
"app",
|
|
281
|
+
"deb",
|
|
282
|
+
"rpm",
|
|
283
|
+
"elf",
|
|
284
|
+
"dll",
|
|
285
|
+
"so",
|
|
286
|
+
"dylib",
|
|
287
|
+
"sys",
|
|
288
|
+
// 🔐 Certificates / Crypto
|
|
289
|
+
"pem",
|
|
290
|
+
"crt",
|
|
291
|
+
"cer",
|
|
292
|
+
"key",
|
|
293
|
+
"der",
|
|
294
|
+
"csr",
|
|
295
|
+
"p12",
|
|
296
|
+
"pfx",
|
|
297
|
+
"jks",
|
|
298
|
+
// 🎮 Games & Projects
|
|
299
|
+
"iso",
|
|
300
|
+
"cue",
|
|
301
|
+
"bin",
|
|
302
|
+
"nes",
|
|
303
|
+
"sfc",
|
|
304
|
+
"gba",
|
|
305
|
+
"nds",
|
|
306
|
+
"nes",
|
|
307
|
+
"sav",
|
|
308
|
+
"rom",
|
|
309
|
+
"pak",
|
|
310
|
+
"vpk",
|
|
311
|
+
"bik",
|
|
312
|
+
// 📚 E-books and Comics
|
|
313
|
+
"epub",
|
|
314
|
+
"mobi",
|
|
315
|
+
"azw",
|
|
316
|
+
"azw3",
|
|
317
|
+
"fb2",
|
|
318
|
+
"lit",
|
|
319
|
+
"lrf",
|
|
320
|
+
"cbr",
|
|
321
|
+
"cbz",
|
|
322
|
+
"cbt",
|
|
323
|
+
"cba",
|
|
324
|
+
"opds",
|
|
325
|
+
// 🔬 Bioinformatics
|
|
326
|
+
"fasta",
|
|
327
|
+
"fa",
|
|
328
|
+
"fas",
|
|
329
|
+
"ffn",
|
|
330
|
+
"faa",
|
|
331
|
+
"fna",
|
|
332
|
+
"frn",
|
|
333
|
+
"fastq",
|
|
334
|
+
"fq",
|
|
335
|
+
"gb",
|
|
336
|
+
"gbk",
|
|
337
|
+
"sam",
|
|
338
|
+
"bam",
|
|
339
|
+
"vcf",
|
|
340
|
+
"gff",
|
|
341
|
+
"bed",
|
|
342
|
+
// 📝 Etc
|
|
343
|
+
"log",
|
|
344
|
+
"bak",
|
|
345
|
+
"tmp",
|
|
346
|
+
"old",
|
|
347
|
+
"backup",
|
|
348
|
+
"swp",
|
|
349
|
+
"part",
|
|
350
|
+
"crdownload",
|
|
351
|
+
"torrent",
|
|
352
|
+
"ics",
|
|
353
|
+
"vcf",
|
|
354
|
+
"ics",
|
|
355
|
+
"ical",
|
|
356
|
+
"ics",
|
|
357
|
+
"ical",
|
|
358
|
+
"calendar",
|
|
359
|
+
"srt",
|
|
360
|
+
"sub",
|
|
361
|
+
"idx",
|
|
362
|
+
"cue",
|
|
363
|
+
// 🧠 Other broad (technical & scientific extensions)
|
|
364
|
+
"cdf",
|
|
365
|
+
"hdf",
|
|
366
|
+
"h5",
|
|
367
|
+
"nc",
|
|
368
|
+
"grib",
|
|
369
|
+
"fits",
|
|
370
|
+
"netcdf",
|
|
371
|
+
"sdf",
|
|
372
|
+
"vtk",
|
|
373
|
+
"xmind",
|
|
374
|
+
"drawio",
|
|
375
|
+
// ⚙️ Packages & Plugins
|
|
376
|
+
"jar",
|
|
377
|
+
"war",
|
|
378
|
+
"ear",
|
|
379
|
+
"crx",
|
|
380
|
+
"xpi",
|
|
381
|
+
"plugin",
|
|
382
|
+
"vsix",
|
|
383
|
+
"safariextz"
|
|
384
|
+
]);
|
|
385
|
+
var DOUBLE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
386
|
+
"tar.gz",
|
|
387
|
+
"tar.bz2",
|
|
388
|
+
"tar.xz",
|
|
389
|
+
"tar.lz",
|
|
390
|
+
"tar.lzma",
|
|
391
|
+
"tar.Z",
|
|
392
|
+
"tar.zst",
|
|
393
|
+
"tar.xz"
|
|
394
|
+
]);
|
|
395
|
+
var extractFileName = (url) => {
|
|
396
|
+
if (!chunkPZQ6I4JJ_cjs.isNonEmptyString(url)) return void 0;
|
|
397
|
+
let fileName = url.split("/").pop();
|
|
398
|
+
if (fileName === "") return "";
|
|
399
|
+
if (!fileName) return void 0;
|
|
400
|
+
for (const ext of DOUBLE_EXTENSIONS) {
|
|
401
|
+
const fullExt = `.${ext}`;
|
|
402
|
+
if (fileName.toLowerCase().endsWith(fullExt)) {
|
|
403
|
+
return fileName.slice(0, -fullExt.length);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
while (true) {
|
|
407
|
+
const lastDot = fileName.lastIndexOf(".");
|
|
408
|
+
if (lastDot === -1) break;
|
|
409
|
+
const ext = fileName.slice(lastDot + 1).toLowerCase();
|
|
410
|
+
if (KNOWN_EXTENSIONS.has(ext)) {
|
|
411
|
+
fileName = fileName.slice(0, lastDot);
|
|
412
|
+
} else {
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
return fileName;
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
exports.extractFileName = extractFileName;
|
package/dist/chunk-GGEADHZO.js
CHANGED
|
@@ -1 +1,90 @@
|
|
|
1
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* ====================================================
|
|
3
|
+
* Rzl Utils-JS.
|
|
4
|
+
* ----------------------------------------------------
|
|
5
|
+
* Version: 3.5.1.
|
|
6
|
+
* Author: Rizalvin Dwiky.
|
|
7
|
+
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
|
+
* ====================================================
|
|
9
|
+
*/
|
|
10
|
+
import { removeSpaces } from './chunk-XEDXFSGI.js';
|
|
11
|
+
import { isEmptyString } from './chunk-W2WNBUDE.js';
|
|
12
|
+
import { safeStableStringify } from './chunk-PET42Z7W.js';
|
|
13
|
+
import { isNonEmptyString, getPreciseType, isError, assertIsPlainObject, hasOwnProp, isBoolean, isFunction } from './chunk-CMW2TBOQ.js';
|
|
14
|
+
|
|
15
|
+
var NormalizePathnameError = class _NormalizePathnameError extends Error {
|
|
16
|
+
/** * ***The original error that triggered this normalization failure.***
|
|
17
|
+
*
|
|
18
|
+
* **Always available for backward compatibility.**
|
|
19
|
+
*/
|
|
20
|
+
originalError;
|
|
21
|
+
constructor(message, originalError) {
|
|
22
|
+
super(message, isFunction(Error) ? { cause: originalError } : void 0);
|
|
23
|
+
this.name = "NormalizePathnameError";
|
|
24
|
+
this.originalError = originalError;
|
|
25
|
+
if (isFunction(Error.captureStackTrace)) {
|
|
26
|
+
Error.captureStackTrace(this, _NormalizePathnameError);
|
|
27
|
+
} else {
|
|
28
|
+
this.stack = new Error(message).stack;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** * ***Safe JSON representation for logging or IPC.*** */
|
|
32
|
+
toJSON() {
|
|
33
|
+
return {
|
|
34
|
+
name: this.name,
|
|
35
|
+
message: this.message,
|
|
36
|
+
stack: this.stack,
|
|
37
|
+
originalError: {
|
|
38
|
+
name: this.originalError.name,
|
|
39
|
+
message: this.originalError.message,
|
|
40
|
+
stack: this.originalError.stack
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
var normalizePathname = (pathname, defaultPath = "/") => {
|
|
47
|
+
if (!isNonEmptyString(defaultPath)) {
|
|
48
|
+
throw new TypeError(
|
|
49
|
+
`Second parameter (\`defaultPath\`) must be of type \`string\` and not empty-string, but received: \`${getPreciseType(
|
|
50
|
+
defaultPath
|
|
51
|
+
)}\`, with value: \`${safeStableStringify(defaultPath)}\`.`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
if (!isNonEmptyString(pathname)) return defaultPath;
|
|
55
|
+
try {
|
|
56
|
+
pathname = removeSpaces(pathname, { trimOnly: true });
|
|
57
|
+
pathname = pathname.replace(/\s+/g, "");
|
|
58
|
+
if (pathname.startsWith("http://") || pathname.startsWith("https://")) {
|
|
59
|
+
const url = new URL(pathname);
|
|
60
|
+
return `${url.pathname}${url.search}${url.hash}`.replace(/^\/+/, "/");
|
|
61
|
+
}
|
|
62
|
+
return "/" + pathname.replace(/^\/+/, "").replace(/\/{2,}/g, "/");
|
|
63
|
+
} catch (error) {
|
|
64
|
+
const err = isError(error) ? error : new Error("Unknown error from function `normalizePathname()`.");
|
|
65
|
+
throw new NormalizePathnameError(
|
|
66
|
+
`Failed to normalize pathname in function \`normalizePathname()\`: ${err.message}`,
|
|
67
|
+
err
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
var formatEnvPort = (envVar, options = {}) => {
|
|
73
|
+
if (!isNonEmptyString(envVar)) return "";
|
|
74
|
+
assertIsPlainObject(options, {
|
|
75
|
+
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
76
|
+
});
|
|
77
|
+
const prefixColon = hasOwnProp(options, "prefixColon") ? options.prefixColon : false;
|
|
78
|
+
if (!isBoolean(prefixColon)) {
|
|
79
|
+
throw new TypeError(
|
|
80
|
+
`Parameter \`prefixColon\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: \`${getPreciseType(
|
|
81
|
+
prefixColon
|
|
82
|
+
)}\`.`
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
const digitsOnly = envVar.replace(/\D+/g, "");
|
|
86
|
+
if (isEmptyString(digitsOnly)) return "";
|
|
87
|
+
return prefixColon ? `:${digitsOnly}` : digitsOnly;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export { formatEnvPort, normalizePathname };
|
package/dist/chunk-GQR4R5WY.js
CHANGED
|
@@ -1 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* ====================================================
|
|
3
|
+
* Rzl Utils-JS.
|
|
4
|
+
* ----------------------------------------------------
|
|
5
|
+
* Version: 3.5.1.
|
|
6
|
+
* Author: Rizalvin Dwiky.
|
|
7
|
+
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
|
+
* ====================================================
|
|
9
|
+
*/
|
|
10
|
+
import { isEmptyString } from './chunk-W2WNBUDE.js';
|
|
11
|
+
import { isEmptyArray, isEmptyObject } from './chunk-6JFCSH7J.js';
|
|
12
|
+
import { assertIsPlainObject, hasOwnProp, assertIsBoolean, isNil, isNaN, isString, isArray, isObject } from './chunk-CMW2TBOQ.js';
|
|
13
|
+
|
|
14
|
+
var isEmptyValue = (value, options = {}) => {
|
|
15
|
+
assertIsPlainObject(options, {
|
|
16
|
+
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
17
|
+
});
|
|
18
|
+
const checkSymbols = hasOwnProp(options, "checkSymbols") ? options.checkSymbols : false;
|
|
19
|
+
assertIsBoolean(checkSymbols, {
|
|
20
|
+
message: ({ currentType, validType }) => `Parameter \`checkSymbols\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
21
|
+
});
|
|
22
|
+
if (isNil(value) || value === false || isNaN(value)) return true;
|
|
23
|
+
if (isString(value)) return isEmptyString(value);
|
|
24
|
+
if (isArray(value)) return isEmptyArray(value);
|
|
25
|
+
if (isObject(value)) {
|
|
26
|
+
return isEmptyObject(value, { checkSymbols });
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { isEmptyValue };
|
package/dist/chunk-H66AC7GK.cjs
CHANGED
|
@@ -1 +1,93 @@
|
|
|
1
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* ====================================================
|
|
3
|
+
* Rzl Utils-JS.
|
|
4
|
+
* ----------------------------------------------------
|
|
5
|
+
* Version: 3.5.1.
|
|
6
|
+
* Author: Rizalvin Dwiky.
|
|
7
|
+
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
|
+
* ====================================================
|
|
9
|
+
*/
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
var chunkKVAL5PAG_cjs = require('./chunk-KVAL5PAG.cjs');
|
|
13
|
+
var chunkE55EQK2U_cjs = require('./chunk-E55EQK2U.cjs');
|
|
14
|
+
var chunkT7PU2V7X_cjs = require('./chunk-T7PU2V7X.cjs');
|
|
15
|
+
var chunkPZQ6I4JJ_cjs = require('./chunk-PZQ6I4JJ.cjs');
|
|
16
|
+
|
|
17
|
+
var NormalizePathnameError = class _NormalizePathnameError extends Error {
|
|
18
|
+
/** * ***The original error that triggered this normalization failure.***
|
|
19
|
+
*
|
|
20
|
+
* **Always available for backward compatibility.**
|
|
21
|
+
*/
|
|
22
|
+
originalError;
|
|
23
|
+
constructor(message, originalError) {
|
|
24
|
+
super(message, chunkPZQ6I4JJ_cjs.isFunction(Error) ? { cause: originalError } : void 0);
|
|
25
|
+
this.name = "NormalizePathnameError";
|
|
26
|
+
this.originalError = originalError;
|
|
27
|
+
if (chunkPZQ6I4JJ_cjs.isFunction(Error.captureStackTrace)) {
|
|
28
|
+
Error.captureStackTrace(this, _NormalizePathnameError);
|
|
29
|
+
} else {
|
|
30
|
+
this.stack = new Error(message).stack;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** * ***Safe JSON representation for logging or IPC.*** */
|
|
34
|
+
toJSON() {
|
|
35
|
+
return {
|
|
36
|
+
name: this.name,
|
|
37
|
+
message: this.message,
|
|
38
|
+
stack: this.stack,
|
|
39
|
+
originalError: {
|
|
40
|
+
name: this.originalError.name,
|
|
41
|
+
message: this.originalError.message,
|
|
42
|
+
stack: this.originalError.stack
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var normalizePathname = (pathname, defaultPath = "/") => {
|
|
49
|
+
if (!chunkPZQ6I4JJ_cjs.isNonEmptyString(defaultPath)) {
|
|
50
|
+
throw new TypeError(
|
|
51
|
+
`Second parameter (\`defaultPath\`) must be of type \`string\` and not empty-string, but received: \`${chunkPZQ6I4JJ_cjs.getPreciseType(
|
|
52
|
+
defaultPath
|
|
53
|
+
)}\`, with value: \`${chunkT7PU2V7X_cjs.safeStableStringify(defaultPath)}\`.`
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
if (!chunkPZQ6I4JJ_cjs.isNonEmptyString(pathname)) return defaultPath;
|
|
57
|
+
try {
|
|
58
|
+
pathname = chunkKVAL5PAG_cjs.removeSpaces(pathname, { trimOnly: true });
|
|
59
|
+
pathname = pathname.replace(/\s+/g, "");
|
|
60
|
+
if (pathname.startsWith("http://") || pathname.startsWith("https://")) {
|
|
61
|
+
const url = new URL(pathname);
|
|
62
|
+
return `${url.pathname}${url.search}${url.hash}`.replace(/^\/+/, "/");
|
|
63
|
+
}
|
|
64
|
+
return "/" + pathname.replace(/^\/+/, "").replace(/\/{2,}/g, "/");
|
|
65
|
+
} catch (error) {
|
|
66
|
+
const err = chunkPZQ6I4JJ_cjs.isError(error) ? error : new Error("Unknown error from function `normalizePathname()`.");
|
|
67
|
+
throw new NormalizePathnameError(
|
|
68
|
+
`Failed to normalize pathname in function \`normalizePathname()\`: ${err.message}`,
|
|
69
|
+
err
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
var formatEnvPort = (envVar, options = {}) => {
|
|
75
|
+
if (!chunkPZQ6I4JJ_cjs.isNonEmptyString(envVar)) return "";
|
|
76
|
+
chunkPZQ6I4JJ_cjs.assertIsPlainObject(options, {
|
|
77
|
+
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
78
|
+
});
|
|
79
|
+
const prefixColon = chunkPZQ6I4JJ_cjs.hasOwnProp(options, "prefixColon") ? options.prefixColon : false;
|
|
80
|
+
if (!chunkPZQ6I4JJ_cjs.isBoolean(prefixColon)) {
|
|
81
|
+
throw new TypeError(
|
|
82
|
+
`Parameter \`prefixColon\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: \`${chunkPZQ6I4JJ_cjs.getPreciseType(
|
|
83
|
+
prefixColon
|
|
84
|
+
)}\`.`
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
const digitsOnly = envVar.replace(/\D+/g, "");
|
|
88
|
+
if (chunkE55EQK2U_cjs.isEmptyString(digitsOnly)) return "";
|
|
89
|
+
return prefixColon ? `:${digitsOnly}` : digitsOnly;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
exports.formatEnvPort = formatEnvPort;
|
|
93
|
+
exports.normalizePathname = normalizePathname;
|
package/dist/chunk-HQWOFR56.cjs
CHANGED
|
@@ -1 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* ====================================================
|
|
3
|
+
* Rzl Utils-JS.
|
|
4
|
+
* ----------------------------------------------------
|
|
5
|
+
* Version: 3.5.1.
|
|
6
|
+
* Author: Rizalvin Dwiky.
|
|
7
|
+
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
|
+
* ====================================================
|
|
9
|
+
*/
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
var chunkE55EQK2U_cjs = require('./chunk-E55EQK2U.cjs');
|
|
13
|
+
var chunkZETAZZLD_cjs = require('./chunk-ZETAZZLD.cjs');
|
|
14
|
+
var chunkPZQ6I4JJ_cjs = require('./chunk-PZQ6I4JJ.cjs');
|
|
15
|
+
|
|
16
|
+
var isEmptyValue = (value, options = {}) => {
|
|
17
|
+
chunkPZQ6I4JJ_cjs.assertIsPlainObject(options, {
|
|
18
|
+
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
19
|
+
});
|
|
20
|
+
const checkSymbols = chunkPZQ6I4JJ_cjs.hasOwnProp(options, "checkSymbols") ? options.checkSymbols : false;
|
|
21
|
+
chunkPZQ6I4JJ_cjs.assertIsBoolean(checkSymbols, {
|
|
22
|
+
message: ({ currentType, validType }) => `Parameter \`checkSymbols\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
23
|
+
});
|
|
24
|
+
if (chunkPZQ6I4JJ_cjs.isNil(value) || value === false || chunkPZQ6I4JJ_cjs.isNaN(value)) return true;
|
|
25
|
+
if (chunkPZQ6I4JJ_cjs.isString(value)) return chunkE55EQK2U_cjs.isEmptyString(value);
|
|
26
|
+
if (chunkPZQ6I4JJ_cjs.isArray(value)) return chunkZETAZZLD_cjs.isEmptyArray(value);
|
|
27
|
+
if (chunkPZQ6I4JJ_cjs.isObject(value)) {
|
|
28
|
+
return chunkZETAZZLD_cjs.isEmptyObject(value, { checkSymbols });
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.isEmptyValue = isEmptyValue;
|