@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.
Files changed (118) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +94 -45
  3. package/dist/assertions/index.cjs +41 -1
  4. package/dist/assertions/index.d.ts +11 -2
  5. package/dist/assertions/index.js +14 -1
  6. package/dist/chunk-2CQX5CBG.js +262 -1
  7. package/dist/chunk-2IOOEY45.cjs +30 -1
  8. package/dist/chunk-2WA36TC5.cjs +189 -0
  9. package/dist/chunk-3IBQ5MOM.js +16 -1
  10. package/dist/chunk-3VA554KW.js +34 -1
  11. package/dist/chunk-5757UBXJ.cjs +157 -1
  12. package/dist/chunk-5IGC6PBH.js +33 -1
  13. package/dist/chunk-5KJFVIQT.cjs +65 -1
  14. package/dist/chunk-6JFCSH7J.js +35 -1
  15. package/dist/chunk-6JFZL7YE.cjs +24 -1
  16. package/dist/chunk-7ODAAXX5.cjs +397 -1
  17. package/dist/chunk-BAV5T2E3.cjs +15 -1
  18. package/dist/chunk-CAH33WOQ.cjs +36 -1
  19. package/dist/chunk-CDCERIZ2.js +177 -0
  20. package/dist/chunk-CKTLUNWX.js +22 -1
  21. package/dist/chunk-CMW2TBOQ.js +567 -1
  22. package/dist/chunk-D3ENH7H6.cjs +101 -1
  23. package/dist/chunk-DEZZUYE2.js +152 -1
  24. package/dist/chunk-DVMHRLKP.cjs +16 -1
  25. package/dist/chunk-DWF2R5GD.cjs +225 -1
  26. package/dist/chunk-E55EQK2U.cjs +18 -1
  27. package/dist/chunk-E74U6CYP.cjs +18 -1
  28. package/dist/chunk-EL6A35UR.cjs +64 -1
  29. package/dist/chunk-F6IPNNSJ.cjs +554 -1
  30. package/dist/chunk-FJZGG54N.cjs +267 -1
  31. package/dist/chunk-FWCKOJZM.js +542 -1
  32. package/dist/chunk-FWHNWL2P.cjs +419 -1
  33. package/dist/chunk-GGEADHZO.js +90 -1
  34. package/dist/chunk-GQR4R5WY.js +31 -1
  35. package/dist/chunk-H66AC7GK.cjs +93 -1
  36. package/dist/chunk-HQWOFR56.cjs +33 -1
  37. package/dist/chunk-HYRQMTRH.cjs +24 -1
  38. package/dist/chunk-IRFL4MAX.js +63 -1
  39. package/dist/chunk-IVL7CKVH.cjs +37 -1
  40. package/dist/chunk-IZPBKKPO.js +16 -1
  41. package/dist/chunk-JBQMXC5I.cjs +106 -1
  42. package/dist/chunk-JEQEF5WD.js +95 -1
  43. package/dist/chunk-JMJQCN74.js +370 -1
  44. package/dist/chunk-KHO2SBNA.cjs +16 -1
  45. package/dist/chunk-KVAL5PAG.cjs +26 -1
  46. package/dist/chunk-L5RDAVVH.js +14 -1
  47. package/dist/chunk-LS6U7FAY.cjs +110 -1
  48. package/dist/chunk-NBZWMBO6.js +101 -1
  49. package/dist/chunk-NRF6LWBC.cjs +56 -1
  50. package/dist/chunk-OI5XKNZO.js +53 -1
  51. package/dist/chunk-ONZFBJVW.js +14 -1
  52. package/dist/chunk-OYTYSY7G.js +106 -1
  53. package/dist/chunk-PET42Z7W.js +119 -1
  54. package/dist/chunk-PZQ6I4JJ.cjs +605 -1
  55. package/dist/chunk-QBKAEVYG.js +113 -1
  56. package/dist/chunk-QNKGP5DY.js +14 -1
  57. package/dist/chunk-RIPKY4RU.js +417 -1
  58. package/dist/chunk-RZW35UN5.cjs +116 -1
  59. package/dist/chunk-SBFNXGTJ.js +220 -1
  60. package/dist/chunk-SBKGWRS5.js +22 -1
  61. package/dist/chunk-SIM77PU4.js +59 -1
  62. package/dist/chunk-T2T7K3KR.js +28 -1
  63. package/dist/chunk-T7PU2V7X.cjs +123 -1
  64. package/dist/chunk-UDA26MCU.cjs +16 -1
  65. package/dist/chunk-V45XJKHW.cjs +18 -1
  66. package/dist/chunk-VJDDGRIK.cjs +16 -1
  67. package/dist/chunk-W2WNBUDE.js +16 -1
  68. package/dist/chunk-WVSPXFTY.js +14 -1
  69. package/dist/chunk-XABCB3Y7.cjs +582 -1
  70. package/dist/chunk-XEDXFSGI.js +24 -1
  71. package/dist/chunk-YKPSRP5G.js +571 -1
  72. package/dist/chunk-YWHHVDT4.js +13 -1
  73. package/dist/chunk-ZETAZZLD.cjs +38 -1
  74. package/dist/conversions/index.cjs +104 -1
  75. package/dist/conversions/index.d.ts +10 -1
  76. package/dist/conversions/index.js +25 -1
  77. package/dist/events/index.cjs +32 -1
  78. package/dist/events/index.d.ts +10 -1
  79. package/dist/events/index.js +13 -1
  80. package/dist/formatters/index.cjs +62 -1
  81. package/dist/formatters/index.d.ts +10 -1
  82. package/dist/formatters/index.js +19 -1
  83. package/dist/generators/index.cjs +38 -1
  84. package/dist/generators/index.d.ts +10 -1
  85. package/dist/generators/index.js +15 -1
  86. package/dist/index.d.ts +39 -12
  87. package/dist/{isPlainObject-CEPWPiXh.d.ts → isPlainObject-FWmcJF6k.d.ts} +13 -4
  88. package/dist/next/index.cjs +218 -1
  89. package/dist/next/index.d.ts +10 -1
  90. package/dist/next/index.js +213 -1
  91. package/dist/next/server/index.cjs +43 -1
  92. package/dist/next/server/index.d.ts +10 -1
  93. package/dist/next/server/index.js +41 -1
  94. package/dist/operations/index.cjs +33 -1
  95. package/dist/operations/index.d.ts +10 -1
  96. package/dist/operations/index.js +18 -1
  97. package/dist/parsers/index.cjs +18 -1
  98. package/dist/parsers/index.d.ts +10 -1
  99. package/dist/parsers/index.js +11 -1
  100. package/dist/predicates/index.cjs +299 -1
  101. package/dist/predicates/index.d.ts +13 -4
  102. package/dist/predicates/index.js +24 -1
  103. package/dist/promises/index.cjs +25 -1
  104. package/dist/promises/index.d.ts +10 -1
  105. package/dist/promises/index.js +14 -1
  106. package/dist/rzl-utils.global.js +25 -1
  107. package/dist/strings/index.cjs +82 -1
  108. package/dist/strings/index.d.ts +10 -1
  109. package/dist/strings/index.js +15 -1
  110. package/dist/tailwind/index.cjs +43 -1
  111. package/dist/tailwind/index.d.ts +10 -1
  112. package/dist/tailwind/index.js +12 -1
  113. package/dist/urls/index.cjs +51 -1
  114. package/dist/urls/index.d.ts +10 -1
  115. package/dist/urls/index.js +24 -1
  116. package/package.json +60 -179
  117. package/dist/chunk-JYQTCICM.js +0 -1
  118. package/dist/chunk-YLA3DURS.cjs +0 -1
@@ -1 +1,419 @@
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
+ /*!
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;
@@ -1 +1,90 @@
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
+ /*!
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 };
@@ -1 +1,31 @@
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
+ /*!
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 };
@@ -1 +1,93 @@
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
+ /*!
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;
@@ -1 +1,33 @@
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
+ /*!
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;