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