@rzl-zone/utils-js 3.9.1 → 3.11.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 +111 -73
- package/dist/assertions/index.cjs +11 -11
- package/dist/assertions/index.d.ts +487 -215
- package/dist/assertions/index.js +5 -5
- package/dist/{chunk-SN5HAK3Y.js → chunk-22V4WP3H.js} +4 -4
- package/dist/{chunk-EJV5AF4L.js → chunk-2XSZ2ANI.js} +2 -2
- package/dist/{chunk-OSSFLQDD.js → chunk-3T6VSWYX.js} +2 -2
- package/dist/{chunk-3LE6NX57.js → chunk-5WIEDF2J.js} +4 -4
- package/dist/{chunk-WLEZ2KSG.cjs → chunk-6EDFZJZ5.cjs} +126 -126
- package/dist/{chunk-GHU356XQ.js → chunk-6LXWT2I5.js} +3 -3
- package/dist/{chunk-GKDSBOYE.js → chunk-6YGBRENU.js} +3 -3
- package/dist/{chunk-NAOVH4OH.cjs → chunk-7FGNVDEV.cjs} +7 -7
- package/dist/{chunk-X6ULJZ3X.js → chunk-AXDYWO67.js} +2 -2
- package/dist/{chunk-UV5BKAYW.cjs → chunk-B6PMNZ4M.cjs} +7 -7
- package/dist/chunk-BAV5T2E3.cjs +1 -1
- package/dist/{chunk-YHFRCVTN.js → chunk-BLF7SD66.js} +3 -3
- package/dist/{chunk-QZI5PVCI.cjs → chunk-BMZZXZJ2.cjs} +4 -4
- package/dist/{chunk-DXPM4NOU.js → chunk-BOYP3ARU.js} +4 -4
- package/dist/{chunk-UXT4XSUK.js → chunk-BPYW5YL7.js} +2 -2
- package/dist/{chunk-QGTFQ7RO.cjs → chunk-C2PV3VWC.cjs} +6 -6
- package/dist/{chunk-MZ3T6L7Z.js → chunk-CCJ2MSN7.js} +2 -2
- package/dist/{chunk-H44QVAZL.cjs → chunk-DAPAK2W3.cjs} +31 -31
- package/dist/{chunk-OYFUBKEG.cjs → chunk-DLS3G6WQ.cjs} +4 -4
- package/dist/{chunk-MS2KSKD7.js → chunk-DNMCR5JH.js} +9 -9
- package/dist/chunk-DVMHRLKP.cjs +1 -1
- package/dist/{chunk-IX6PF5ZP.cjs → chunk-EBYFYZW4.cjs} +4 -4
- package/dist/{chunk-5Y6JL47L.js → chunk-ENMRZ4BE.js} +3 -3
- package/dist/{chunk-7EIFPHV3.js → chunk-FJ4BQFVO.js} +8 -8
- package/dist/{chunk-TJ5OY6MC.cjs → chunk-GIKL4PUF.cjs} +10 -10
- package/dist/{chunk-M5QB2GM5.js → chunk-GOFINGT6.js} +2 -2
- package/dist/{chunk-J6VLFVIL.js → chunk-GXKQ3LHF.js} +3 -3
- package/dist/{chunk-5KDVIEVO.js → chunk-HNBRGN4R.js} +2 -2
- package/dist/{chunk-OCTHWEZK.cjs → chunk-HYN6FC5A.cjs} +34 -34
- package/dist/{chunk-MBFVTGYS.js → chunk-IZGVBYFN.js} +4 -4
- package/dist/{chunk-QXTJVDWE.js → chunk-JIE447J5.js} +3 -3
- package/dist/{chunk-UFYMRRJH.cjs → chunk-JXEIJM5M.cjs} +61 -61
- package/dist/{chunk-WB3FT62A.js → chunk-K47GZDBH.js} +3 -3
- package/dist/{chunk-KUVRZ2JW.cjs → chunk-K5536YHG.cjs} +50 -50
- package/dist/chunk-KHO2SBNA.cjs +1 -1
- package/dist/{chunk-NJ24M6ZH.cjs → chunk-KXJ7X325.cjs} +37 -37
- package/dist/chunk-L5RDAVVH.js +1 -1
- package/dist/{chunk-SRWL4YCP.js → chunk-LJHPTLWB.js} +7 -7
- package/dist/{chunk-6AMDHVS2.cjs → chunk-M7ELWZXM.cjs} +9 -9
- package/dist/chunk-MSUW5VHZ.js +1590 -0
- package/dist/{chunk-2XGQQZ6A.cjs → chunk-MUHRPRR7.cjs} +3 -3
- package/dist/{chunk-XYWC4EQ3.cjs → chunk-MV3TSQSH.cjs} +71 -71
- package/dist/{chunk-VCYXNIZ2.cjs → chunk-NLZLXWAU.cjs} +9 -9
- package/dist/{chunk-76ATVDCR.cjs → chunk-NVRZPF5M.cjs} +3 -3
- package/dist/chunk-ONZFBJVW.js +1 -1
- package/dist/{chunk-62FS7WMB.cjs → chunk-PGNL7JXO.cjs} +31 -31
- package/dist/{chunk-JI57K7D4.cjs → chunk-Q4GEQS7X.cjs} +161 -161
- package/dist/chunk-QNKGP5DY.js +1 -1
- package/dist/{chunk-ZTHJQJ5F.cjs → chunk-QYI2VJLS.cjs} +9 -9
- package/dist/{chunk-C7GC2PFX.js → chunk-RBWZII5I.js} +3 -3
- package/dist/{chunk-MMRHKYT6.cjs → chunk-RMP7VMPB.cjs} +12 -12
- package/dist/{chunk-TXOVQZPU.js → chunk-RZOGBYIS.js} +2 -2
- package/dist/{chunk-ALRISPTL.cjs → chunk-SU3UELUB.cjs} +3 -3
- package/dist/chunk-SYHPSOUU.cjs +1626 -0
- package/dist/{chunk-R2DR7SPJ.js → chunk-SZUNAEMR.js} +6 -6
- package/dist/{chunk-YVRUY4EW.cjs → chunk-TER22LO4.cjs} +8 -8
- package/dist/{chunk-WRGN6UBK.js → chunk-TJHGRQ4P.js} +2 -2
- package/dist/{chunk-I33PB44Q.cjs → chunk-U23I7JPB.cjs} +15 -15
- package/dist/{chunk-VBSLIIDB.js → chunk-U7HHN47R.js} +10 -10
- package/dist/chunk-UDA26MCU.cjs +1 -1
- package/dist/{chunk-44X74C26.js → chunk-UIAWUZ4H.js} +4 -4
- package/dist/{chunk-5O66AUEC.js → chunk-ULQPCIA2.js} +2 -2
- package/dist/chunk-VJDDGRIK.cjs +1 -1
- package/dist/{chunk-6WVOUVWD.js → chunk-WETQI6HM.js} +9 -9
- package/dist/{chunk-FWWPEL7J.cjs → chunk-WLOQQFDS.cjs} +3 -3
- package/dist/chunk-WVSPXFTY.js +1 -1
- package/dist/{chunk-WKM6UVMG.cjs → chunk-WXFTVXBF.cjs} +4 -4
- package/dist/{chunk-YQHJB7KR.cjs → chunk-XPVTIGU2.cjs} +26 -26
- package/dist/{chunk-PWKOFPAH.cjs → chunk-XX6RUGTM.cjs} +3 -3
- package/dist/chunk-YWHHVDT4.js +1 -1
- package/dist/{chunk-7NXFGJJE.cjs → chunk-ZPDMWDGZ.cjs} +14 -14
- package/dist/{chunk-JYOCB6OV.js → chunk-ZVWZEGQP.js} +2 -2
- package/dist/conversions/index.cjs +34 -34
- package/dist/conversions/index.d.ts +489 -333
- package/dist/conversions/index.js +15 -15
- package/dist/events/index.cjs +8 -8
- package/dist/events/index.d.ts +35 -29
- package/dist/events/index.js +4 -4
- package/dist/formatters/index.cjs +19 -19
- package/dist/formatters/index.d.ts +917 -873
- package/dist/formatters/index.js +9 -9
- package/dist/generators/index.cjs +9 -9
- package/dist/generators/index.d.ts +104 -86
- package/dist/generators/index.js +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/isPlainObject-0p3VveWr.d.ts +534 -0
- package/dist/next/index.cjs +37 -37
- package/dist/next/index.d.ts +36 -21
- package/dist/next/index.js +9 -9
- package/dist/next/server/index.cjs +4 -4
- package/dist/next/server/index.d.ts +6 -3
- package/dist/next/server/index.js +2 -2
- package/dist/operations/index.cjs +11 -11
- package/dist/operations/index.d.ts +14 -5
- package/dist/operations/index.js +8 -8
- package/dist/parsers/index.cjs +6 -6
- package/dist/parsers/index.d.ts +68 -65
- package/dist/parsers/index.js +5 -5
- package/dist/predicates/index.cjs +77 -77
- package/dist/predicates/index.d.ts +442 -258
- package/dist/predicates/index.js +14 -14
- package/dist/promises/index.cjs +6 -6
- package/dist/promises/index.d.ts +28 -16
- package/dist/promises/index.js +4 -4
- package/dist/rzl-utils.global.js +2 -2
- package/dist/strings/index.cjs +23 -23
- package/dist/strings/index.d.ts +82 -54
- package/dist/strings/index.js +7 -7
- package/dist/tailwind/index.cjs +13 -13
- package/dist/tailwind/index.d.ts +186 -169
- package/dist/tailwind/index.js +5 -5
- package/dist/urls/index.cjs +23 -23
- package/dist/urls/index.d.ts +252 -229
- package/dist/urls/index.js +16 -16
- package/package.json +3 -3
- package/dist/chunk-7C7TQC5J.cjs +0 -620
- package/dist/chunk-J4TT33ZX.js +0 -584
- package/dist/isPlainObject-BTPjv6zB.d.ts +0 -178
package/dist/chunk-J4TT33ZX.js
DELETED
|
@@ -1,584 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* ====================================================
|
|
3
|
-
* Rzl Utils-JS.
|
|
4
|
-
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.9.1.
|
|
6
|
-
* Author: Rizalvin Dwiky.
|
|
7
|
-
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
|
-
* ====================================================
|
|
9
|
-
*/
|
|
10
|
-
var isBoolean = (value) => {
|
|
11
|
-
return typeof value === "boolean";
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
var isFunction = (value) => {
|
|
15
|
-
return typeof value === "function";
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
function isNil(value) {
|
|
19
|
-
return value == null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function isArray(value) {
|
|
23
|
-
return Array.isArray(value);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function isObject(value) {
|
|
27
|
-
return typeof value === "object" && !isNil(value) && !isArray(value);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function isPlainObject(value) {
|
|
31
|
-
if (!isObject(value)) return false;
|
|
32
|
-
const proto = Object.getPrototypeOf(value);
|
|
33
|
-
return proto === Object.prototype || proto === null;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
var isString = (value) => {
|
|
37
|
-
return typeof value === "string";
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
function isNumberObject(value) {
|
|
41
|
-
return isObject(value) && Object.prototype.toString.call(value) === "[object Number]";
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function isNaN(value) {
|
|
45
|
-
return typeof value === "number" ? Number.isNaN(value) : isNumberObject(value) && Number.isNaN(value.valueOf());
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
var isNull = (val) => val === null;
|
|
49
|
-
|
|
50
|
-
var assertIsBoolean = (value, options = {}) => {
|
|
51
|
-
if (isBoolean(value)) return;
|
|
52
|
-
resolveErrorMessageAssertions({
|
|
53
|
-
value,
|
|
54
|
-
options,
|
|
55
|
-
requiredValidType: "boolean"
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
var isNumber = (value, options = {}) => {
|
|
60
|
-
assertIsPlainObject(options, {
|
|
61
|
-
message: ({ currentType, validType: validType2 }) => `Second parameter (\`options\`) must be of type \`${validType2}\`, but received: \`${currentType}\`.`
|
|
62
|
-
});
|
|
63
|
-
const includeNaN = isPlainObject(options) && isBoolean(options.includeNaN) ? options.includeNaN : false;
|
|
64
|
-
assertIsBoolean(includeNaN, {
|
|
65
|
-
message: ({ currentType, validType: validType2 }) => `Parameter \`includeNaN\` property of the \`options\` (second parameter) must be of type \`${validType2}\`, but received: \`${currentType}\`.`
|
|
66
|
-
});
|
|
67
|
-
const aNumber = typeof value === "number";
|
|
68
|
-
return includeNaN ? aNumber : aNumber && !Number.isNaN(value);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
var isSymbol = (value) => {
|
|
72
|
-
return typeof value === "symbol";
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
var isUndefined = (value) => {
|
|
76
|
-
return typeof value === "undefined";
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
function isObjectOrArray(value) {
|
|
80
|
-
return isArray(value) || isObject(value);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function hasOwnProp(obj, key, options = {}) {
|
|
84
|
-
if (!isString(obj) && !isObjectOrArray(obj) && !isFunction(obj)) return false;
|
|
85
|
-
assertIsPlainObject(options, {
|
|
86
|
-
message: ({ currentType, validType: validType2 }) => `Third parameter (\`options\`) must be of type \`${validType2}\`, but received: \`${currentType}\`.`
|
|
87
|
-
});
|
|
88
|
-
const discardUndefined = options.discardUndefined === void 0 ? true : options.discardUndefined;
|
|
89
|
-
const discardNull = options.discardNull === void 0 ? false : options.discardNull;
|
|
90
|
-
assertIsBoolean(discardUndefined, {
|
|
91
|
-
message: ({ currentType, validType: validType2 }) => `Parameter \`discardUndefined\` property of the \`options\` (third parameter) must be of type \`${validType2}\`, but received: \`${currentType}\`.`
|
|
92
|
-
});
|
|
93
|
-
assertIsBoolean(discardNull, {
|
|
94
|
-
message: ({ currentType, validType: validType2 }) => `Parameter \`discardNull\` property of the \`options\` (third parameter) must be of type \`${validType2}\`, but received: \`${currentType}\`.`
|
|
95
|
-
});
|
|
96
|
-
const path = [];
|
|
97
|
-
if (isString(key) && key.trim().length > 0 || isNumber(key, { includeNaN: true })) {
|
|
98
|
-
const strKey = isNumber(key, { includeNaN: true }) ? String(key) : key;
|
|
99
|
-
strKey.split(".").forEach((k) => {
|
|
100
|
-
const bracketMatch = k.match(/^\[(\d+)\]$/);
|
|
101
|
-
const symbolMatch = k.match(/^Symbol\((.+)\)$/);
|
|
102
|
-
if (bracketMatch) path.push(Number(bracketMatch[1]));
|
|
103
|
-
else if (symbolMatch) path.push(Symbol.for(symbolMatch[1]));
|
|
104
|
-
else if (!isNaN(Number(k))) path.push(Number(k));
|
|
105
|
-
else path.push(k);
|
|
106
|
-
});
|
|
107
|
-
} else if (isSymbol(key)) {
|
|
108
|
-
path.push(key);
|
|
109
|
-
} else {
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
let current = isString(obj) && obj.trim().length > 0 ? Object(obj) : obj;
|
|
113
|
-
for (const k of path) {
|
|
114
|
-
if (isString(k) && k.trim().length > 0 || isNumber(k, { includeNaN: true })) {
|
|
115
|
-
if (isNull(current) || !Object.prototype.hasOwnProperty.call(current, k)) {
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
current = current[k];
|
|
119
|
-
} else if (isSymbol(k)) {
|
|
120
|
-
if (isNull(current) || typeof current !== "object" && !isFunction(current)) {
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
const symbols = Object.getOwnPropertySymbols(current);
|
|
124
|
-
const matched = symbols.find((s) => s === k || s.description === k.description);
|
|
125
|
-
if (!matched) return false;
|
|
126
|
-
current = current[matched];
|
|
127
|
-
} else {
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
if (discardUndefined && isUndefined(current)) return false;
|
|
132
|
-
if (discardNull && isNull(current)) return false;
|
|
133
|
-
return true;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
var isNonEmptyString = (value, options = {}) => {
|
|
137
|
-
if (!isString(value)) return false;
|
|
138
|
-
assertIsPlainObject(options, {
|
|
139
|
-
message: ({ currentType, validType: validType2 }) => `Second parameter (\`options\`) must be of type \`${validType2}\`, but received: \`${currentType}\`.`
|
|
140
|
-
});
|
|
141
|
-
const trim = hasOwnProp(options, "trim") ? options.trim : true;
|
|
142
|
-
assertIsBoolean(trim, {
|
|
143
|
-
message: ({ currentType, validType: validType2 }) => `Parameter \`trim\` property of the \`options\` (second parameter) must be of type \`${validType2}\`, but received: \`${currentType}\`.`
|
|
144
|
-
});
|
|
145
|
-
const str = trim ? value.trim() : value;
|
|
146
|
-
return str.length > 0;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
var isError = (error) => {
|
|
150
|
-
return Object.prototype.toString.call(error) === "[object Error]" || error instanceof Error;
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
var isBuffer = (value) => {
|
|
154
|
-
return typeof Buffer !== "undefined" && typeof Buffer.isBuffer === "function" && Buffer.isBuffer(value);
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
function isStringObject(value) {
|
|
158
|
-
return isObject(value) && Object.prototype.toString.call(value) === "[object String]";
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function isBooleanObject(value) {
|
|
162
|
-
return isObject(value) && Object.prototype.toString.call(value) === "[object Boolean]";
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function isInfinityNumber(value) {
|
|
166
|
-
if (typeof value === "number" || isNumberObject(value)) {
|
|
167
|
-
const num = Number(value);
|
|
168
|
-
return num === Infinity || num === -Infinity;
|
|
169
|
-
}
|
|
170
|
-
return false;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
var __internalAcronyms__ = Object.freeze([
|
|
174
|
-
"URI",
|
|
175
|
-
"URL",
|
|
176
|
-
"HTTP",
|
|
177
|
-
"HTTPS",
|
|
178
|
-
"HTML",
|
|
179
|
-
"XML",
|
|
180
|
-
"CSS",
|
|
181
|
-
"JS",
|
|
182
|
-
"JSON",
|
|
183
|
-
"SVG",
|
|
184
|
-
"DOM",
|
|
185
|
-
"UTC",
|
|
186
|
-
"XHR",
|
|
187
|
-
"RTC",
|
|
188
|
-
"ICE",
|
|
189
|
-
"TLS",
|
|
190
|
-
"TCP",
|
|
191
|
-
"UDP",
|
|
192
|
-
"IDB",
|
|
193
|
-
"ID"
|
|
194
|
-
]);
|
|
195
|
-
var FIXES_RAW = {
|
|
196
|
-
// primitives
|
|
197
|
-
string: "String",
|
|
198
|
-
number: "Number",
|
|
199
|
-
boolean: "Boolean",
|
|
200
|
-
bigint: "Big Int",
|
|
201
|
-
symbol: "Symbol",
|
|
202
|
-
undefined: "Undefined",
|
|
203
|
-
null: "Null",
|
|
204
|
-
regexp: "Reg Exp",
|
|
205
|
-
// reflect / proxy / atomics
|
|
206
|
-
reflect: "Reflect",
|
|
207
|
-
proxy: "Proxy",
|
|
208
|
-
atomics: "Atomics",
|
|
209
|
-
// core / objects
|
|
210
|
-
object: "Object",
|
|
211
|
-
array: "Array",
|
|
212
|
-
arguments: "Arguments",
|
|
213
|
-
function: "Function",
|
|
214
|
-
// functions
|
|
215
|
-
asyncfunction: "Async Function",
|
|
216
|
-
generatorfunction: "Generator Function",
|
|
217
|
-
asyncgeneratorfunction: "Async Generator Function",
|
|
218
|
-
generator: "Generator",
|
|
219
|
-
promise: "Promise",
|
|
220
|
-
// errors
|
|
221
|
-
evalerror: "Eval Error",
|
|
222
|
-
rangeerror: "Range Error",
|
|
223
|
-
referenceerror: "Reference Error",
|
|
224
|
-
syntaxerror: "Syntax Error",
|
|
225
|
-
typeerror: "Type Error",
|
|
226
|
-
urierror: "URI Error",
|
|
227
|
-
aggregateerror: "Aggregate Error",
|
|
228
|
-
error: "Error",
|
|
229
|
-
// typed arrays & binary
|
|
230
|
-
int8array: "Int 8 Array",
|
|
231
|
-
uint8array: "Uint 8 Array",
|
|
232
|
-
uint8clampedarray: "Uint 8 Clamped Array",
|
|
233
|
-
int16array: "Int 16 Array",
|
|
234
|
-
uint16array: "Uint 16 Array",
|
|
235
|
-
int32array: "Int 32 Array",
|
|
236
|
-
uint32array: "Uint 32 Array",
|
|
237
|
-
float32array: "Float 32 Array",
|
|
238
|
-
float64array: "Float 64 Array",
|
|
239
|
-
bigint64array: "Big Int 64 Array",
|
|
240
|
-
biguint64array: "Big Uint 64 Array",
|
|
241
|
-
arraybuffer: "Array Buffer",
|
|
242
|
-
sharedarraybuffer: "Shared Array Buffer",
|
|
243
|
-
dataview: "Data View",
|
|
244
|
-
arraybufferview: "Array Buffer View",
|
|
245
|
-
// collections
|
|
246
|
-
map: "Map",
|
|
247
|
-
set: "Set",
|
|
248
|
-
weakmap: "Weak Map",
|
|
249
|
-
weakset: "Weak Set",
|
|
250
|
-
// iterators (note: toString tag can be "Map Iterator" etc.)
|
|
251
|
-
mapiterator: "Map Iterator",
|
|
252
|
-
setiterator: "Set Iterator",
|
|
253
|
-
arrayiterator: "Array Iterator",
|
|
254
|
-
stringiterator: "String Iterator",
|
|
255
|
-
// streams / fetch / web
|
|
256
|
-
readablestream: "Readable Stream",
|
|
257
|
-
writablestream: "Writable Stream",
|
|
258
|
-
transformstream: "Transform Stream",
|
|
259
|
-
readablestreamdefaultreader: "Readable Stream Default Reader",
|
|
260
|
-
writablestreamdefaultwriter: "Writable Stream Default Writer",
|
|
261
|
-
readablestreamdefaultcontroller: "Readable Stream Default Controller",
|
|
262
|
-
transformstreamdefaultcontroller: "Transform Stream Default Controller",
|
|
263
|
-
abortcontroller: "Abort Controller",
|
|
264
|
-
abortsignal: "Abort Signal",
|
|
265
|
-
fetch: "fetch",
|
|
266
|
-
request: "Request",
|
|
267
|
-
response: "Response",
|
|
268
|
-
headers: "Headers",
|
|
269
|
-
formdata: "FormData",
|
|
270
|
-
blob: "Blob",
|
|
271
|
-
file: "File",
|
|
272
|
-
filelist: "FileList",
|
|
273
|
-
filereader: "FileReader",
|
|
274
|
-
// intl
|
|
275
|
-
intl: "Intl",
|
|
276
|
-
collator: "Intl. Collator",
|
|
277
|
-
datetimeformat: "Intl. Date Time Format",
|
|
278
|
-
listformat: "Intl. List Format",
|
|
279
|
-
numberformat: "Intl. Number Format",
|
|
280
|
-
pluralrules: "Intl. Plural Rules",
|
|
281
|
-
relativetimeformat: "Intl. Relative Time Format",
|
|
282
|
-
segmenter: "Intl. Segmenter",
|
|
283
|
-
locale: "Intl. Locale",
|
|
284
|
-
displaynames: "Intl. Display Names",
|
|
285
|
-
// es2021+
|
|
286
|
-
finalizationregistry: "Finalization Registry",
|
|
287
|
-
weakref: "Weak Ref",
|
|
288
|
-
structuredclone: "structured Clone",
|
|
289
|
-
urlpattern: "URL Pattern",
|
|
290
|
-
// performance / observers
|
|
291
|
-
performance: "Performance",
|
|
292
|
-
performanceobserver: "Performance Observer",
|
|
293
|
-
performanceentry: "Performance Entry",
|
|
294
|
-
performancemark: "Performance Mark",
|
|
295
|
-
performancemeasure: "Performance Measure",
|
|
296
|
-
// webassembly
|
|
297
|
-
webassembly: "Web Assembly",
|
|
298
|
-
wasmmodule: "WebAssembly .Module",
|
|
299
|
-
wasminstance: "WebAssembly. Instance",
|
|
300
|
-
wasmmemory: "WebAssembly. Memory",
|
|
301
|
-
wasmtable: "WebAssembly. Table",
|
|
302
|
-
// node-ish / common hosts
|
|
303
|
-
buffer: "Buffer",
|
|
304
|
-
process: "Process",
|
|
305
|
-
eventemitter: "Event Emitter",
|
|
306
|
-
stream: "Stream",
|
|
307
|
-
fs: "fs",
|
|
308
|
-
path: "path",
|
|
309
|
-
url: "URL",
|
|
310
|
-
urlsearchparams: "URL Search Params",
|
|
311
|
-
// DOM basics
|
|
312
|
-
node: "Node",
|
|
313
|
-
element: "Element",
|
|
314
|
-
htmlelement: "HTML Element",
|
|
315
|
-
svgelement: "SVG Element",
|
|
316
|
-
document: "Document",
|
|
317
|
-
documentfragment: "Document Fragment",
|
|
318
|
-
shadowroot: "Shadow Root",
|
|
319
|
-
nodelist: "Node List",
|
|
320
|
-
htmlcollection: "HTML Collection",
|
|
321
|
-
// observers / misc DOM
|
|
322
|
-
mutationobserver: "Mutation Observer",
|
|
323
|
-
intersectionobserver: "Intersection Observer",
|
|
324
|
-
resizeobserver: "Resize Observer"
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
function isNonEmptyArray(value) {
|
|
328
|
-
return Array.isArray(value) && value.length > 0;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
function isSet(value) {
|
|
332
|
-
return Object.prototype.toString.call(value) === "[object Set]" || value instanceof Set;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
var validateCaseInputWordsCase = (input) => {
|
|
336
|
-
let result = "";
|
|
337
|
-
if (isArray(input)) {
|
|
338
|
-
result = input.map((x) => isNonEmptyString(x) ? x.trim() : "").filter((x) => x.length).join("-");
|
|
339
|
-
} else if (isNonEmptyString(input)) {
|
|
340
|
-
result = input.trim();
|
|
341
|
-
}
|
|
342
|
-
return result.split(/[^\p{L}\p{N}]+/u).filter(Boolean);
|
|
343
|
-
};
|
|
344
|
-
var validateCaseIgnoreWordsCase = (ignoreWord) => {
|
|
345
|
-
const result = /* @__PURE__ */ new Set([]);
|
|
346
|
-
const normalizeWord = (word) => word.trim().split(/[^\p{L}\p{N}]+/u).filter(Boolean).join("");
|
|
347
|
-
if (isNonEmptyString(ignoreWord)) {
|
|
348
|
-
const clean = normalizeWord(ignoreWord);
|
|
349
|
-
if (clean) result.add(clean);
|
|
350
|
-
}
|
|
351
|
-
if (isNonEmptyArray(ignoreWord)) {
|
|
352
|
-
ignoreWord.forEach((w) => {
|
|
353
|
-
if (isNonEmptyString(w)) {
|
|
354
|
-
const clean = normalizeWord(w);
|
|
355
|
-
if (clean) result.add(clean);
|
|
356
|
-
}
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
if (isSet(ignoreWord)) {
|
|
360
|
-
ignoreWord.forEach((w) => {
|
|
361
|
-
if (isNonEmptyString(w)) {
|
|
362
|
-
const clean = normalizeWord(w);
|
|
363
|
-
if (clean) result.add(clean);
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
return result;
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
var slugify = (input, ignoreWord) => {
|
|
371
|
-
if (!isNonEmptyArray(input) && !isNonEmptyString(input)) return "";
|
|
372
|
-
const wordsValidated = validateCaseInputWordsCase(input);
|
|
373
|
-
const ignoreWordsValidated = validateCaseIgnoreWordsCase(ignoreWord);
|
|
374
|
-
const slug = wordsValidated.map((word) => {
|
|
375
|
-
if (ignoreWordsValidated.has(word)) return word;
|
|
376
|
-
return word.toLowerCase();
|
|
377
|
-
}).join("-");
|
|
378
|
-
return slug.replace(/^-+|-+$/g, "");
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
var toDotCase = (input, ignoreWord) => {
|
|
382
|
-
if (!isNonEmptyArray(input) && !isNonEmptyString(input)) return "";
|
|
383
|
-
const wordsValidated = validateCaseInputWordsCase(input);
|
|
384
|
-
const ignoreWordsValidated = validateCaseIgnoreWordsCase(ignoreWord);
|
|
385
|
-
return wordsValidated.map((word) => {
|
|
386
|
-
if (ignoreWordsValidated.has(word)) return word;
|
|
387
|
-
return word.toLowerCase();
|
|
388
|
-
}).join(".");
|
|
389
|
-
};
|
|
390
|
-
|
|
391
|
-
var toCamelCase = (input, ignoreWord) => {
|
|
392
|
-
if (!isNonEmptyArray(input) && !isNonEmptyString(input)) return "";
|
|
393
|
-
const wordsValidated = validateCaseInputWordsCase(input);
|
|
394
|
-
const ignoreWordsValidated = validateCaseIgnoreWordsCase(ignoreWord);
|
|
395
|
-
return wordsValidated.map((word, index) => {
|
|
396
|
-
if (ignoreWordsValidated.has(word)) return word;
|
|
397
|
-
return index === 0 ? word.toLowerCase() : word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
398
|
-
}).join("");
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
var toKebabCase = (input, ignoreWord) => {
|
|
402
|
-
if (!isNonEmptyArray(input) && !isNonEmptyString(input)) return "";
|
|
403
|
-
const wordsValidated = validateCaseInputWordsCase(input);
|
|
404
|
-
const ignoreWordsValidated = validateCaseIgnoreWordsCase(ignoreWord);
|
|
405
|
-
return wordsValidated.map((word) => {
|
|
406
|
-
if (ignoreWordsValidated.has(word)) return word;
|
|
407
|
-
return word.toLowerCase();
|
|
408
|
-
}).join("-");
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
var toSnakeCase = (input, ignoreWord) => {
|
|
412
|
-
if (!isNonEmptyArray(input) && !isNonEmptyString(input)) return "";
|
|
413
|
-
const wordsValidated = validateCaseInputWordsCase(input);
|
|
414
|
-
const ignoreWordsValidated = validateCaseIgnoreWordsCase(ignoreWord);
|
|
415
|
-
return wordsValidated.map((word) => {
|
|
416
|
-
if (ignoreWordsValidated.has(word)) return word;
|
|
417
|
-
return word.toLowerCase();
|
|
418
|
-
}).join("_");
|
|
419
|
-
};
|
|
420
|
-
|
|
421
|
-
var toLowerCase = (input, ignoreWord) => {
|
|
422
|
-
if (!isNonEmptyArray(input) && !isNonEmptyString(input)) return "";
|
|
423
|
-
const wordsValidated = validateCaseInputWordsCase(input);
|
|
424
|
-
const ignoreWordsValidated = validateCaseIgnoreWordsCase(ignoreWord);
|
|
425
|
-
return wordsValidated.map((word) => {
|
|
426
|
-
if (ignoreWordsValidated.has(word)) return word;
|
|
427
|
-
return word.toLowerCase();
|
|
428
|
-
}).join(" ");
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
var toPascalCase = (input, ignoreWord) => {
|
|
432
|
-
if (!isNonEmptyArray(input) && !isNonEmptyString(input)) return "";
|
|
433
|
-
const wordsValidated = validateCaseInputWordsCase(input);
|
|
434
|
-
const ignoreWordsValidated = validateCaseIgnoreWordsCase(ignoreWord);
|
|
435
|
-
return wordsValidated.map((word) => {
|
|
436
|
-
if (ignoreWordsValidated.has(word)) return word;
|
|
437
|
-
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
438
|
-
}).join("");
|
|
439
|
-
};
|
|
440
|
-
|
|
441
|
-
var toPascalCaseSpace = (input, ignoreWord) => {
|
|
442
|
-
if (!isNonEmptyArray(input) && !isNonEmptyString(input)) return "";
|
|
443
|
-
const wordsValidated = validateCaseInputWordsCase(input);
|
|
444
|
-
const ignoreWordsValidated = validateCaseIgnoreWordsCase(ignoreWord);
|
|
445
|
-
return wordsValidated.map((word) => {
|
|
446
|
-
if (ignoreWordsValidated.has(word)) return word;
|
|
447
|
-
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
448
|
-
}).join(" ");
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
var normalizeKey = (k) => k.replace(/[\s_\-]+/g, "").toLowerCase();
|
|
452
|
-
var FIXES = Object.entries(FIXES_RAW).reduce((acc, [k, v]) => {
|
|
453
|
-
acc[normalizeKey(k)] = v;
|
|
454
|
-
return acc;
|
|
455
|
-
}, {});
|
|
456
|
-
function isProxy(value) {
|
|
457
|
-
if (typeof value !== "object" || value === null) return false;
|
|
458
|
-
const tag = Object.prototype.toString.call(value);
|
|
459
|
-
const skipTags = [
|
|
460
|
-
"[object Array]",
|
|
461
|
-
"[object Date]",
|
|
462
|
-
"[object RegExp]",
|
|
463
|
-
"[object Map]",
|
|
464
|
-
"[object Set]",
|
|
465
|
-
"[object WeakMap]",
|
|
466
|
-
"[object WeakSet]",
|
|
467
|
-
"[object Function]",
|
|
468
|
-
"[object Error]",
|
|
469
|
-
"[object Promise]",
|
|
470
|
-
"[object Generator]",
|
|
471
|
-
"[object GeneratorFunction]",
|
|
472
|
-
"[object AsyncFunction]"
|
|
473
|
-
];
|
|
474
|
-
if (skipTags.includes(tag)) return false;
|
|
475
|
-
try {
|
|
476
|
-
Reflect.defineProperty(value, "__proxy_detect__", {
|
|
477
|
-
configurable: true,
|
|
478
|
-
value: 1
|
|
479
|
-
});
|
|
480
|
-
Reflect.deleteProperty(value, "__proxy_detect__");
|
|
481
|
-
return false;
|
|
482
|
-
} catch {
|
|
483
|
-
return true;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
var converterHelper = (input, formatCase) => {
|
|
487
|
-
if (formatCase === "toPascalCaseSpace")
|
|
488
|
-
return toPascalCaseSpace(input, __internalAcronyms__);
|
|
489
|
-
if (formatCase === "slugify") return slugify(input, __internalAcronyms__);
|
|
490
|
-
if (formatCase === "toCamelCase") return toCamelCase(input, __internalAcronyms__);
|
|
491
|
-
if (formatCase === "toDotCase") return toDotCase(input, __internalAcronyms__);
|
|
492
|
-
if (formatCase === "toKebabCase") return toKebabCase(input, __internalAcronyms__);
|
|
493
|
-
if (formatCase === "toPascalCase") return toPascalCase(input, __internalAcronyms__);
|
|
494
|
-
if (formatCase === "toSnakeCase") return toSnakeCase(input, __internalAcronyms__);
|
|
495
|
-
return toLowerCase(input, __internalAcronyms__);
|
|
496
|
-
};
|
|
497
|
-
var getPreciseType = (value, options = { formatCase: "toLowerCase" }) => {
|
|
498
|
-
if (!isPlainObject(options)) options = {};
|
|
499
|
-
const formatCase = options.formatCase;
|
|
500
|
-
if (isNull(value)) {
|
|
501
|
-
return converterHelper(FIXES[normalizeKey("null")] ?? "Null", formatCase);
|
|
502
|
-
}
|
|
503
|
-
if (isNaN(value)) return "NaN";
|
|
504
|
-
if (isInfinityNumber(value)) return String(value);
|
|
505
|
-
if (isNumberObject(value)) return converterHelper("Number Constructor", formatCase);
|
|
506
|
-
if (isStringObject(value)) return converterHelper("String Constructor", formatCase);
|
|
507
|
-
if (isBooleanObject(value)) return converterHelper("Boolean Constructor", formatCase);
|
|
508
|
-
const prim = typeof value;
|
|
509
|
-
if (!isObjectOrArray(value) && !isFunction(value)) {
|
|
510
|
-
return converterHelper(FIXES[normalizeKey(prim)] ?? prim, formatCase);
|
|
511
|
-
}
|
|
512
|
-
if (isBuffer(value)) {
|
|
513
|
-
return converterHelper(FIXES[normalizeKey("buffer")] ?? "Buffer", formatCase);
|
|
514
|
-
}
|
|
515
|
-
if (isProxy(value)) {
|
|
516
|
-
return converterHelper(FIXES[normalizeKey("proxy")] ?? "Proxy", formatCase);
|
|
517
|
-
}
|
|
518
|
-
if (isObject(value) && isFunction(value?.next) && isFunction(value?.throw)) {
|
|
519
|
-
return converterHelper(FIXES[normalizeKey("generator")] ?? "Generator", formatCase);
|
|
520
|
-
}
|
|
521
|
-
if (isError(value)) {
|
|
522
|
-
const ctorName2 = value.constructor?.name ?? "Error";
|
|
523
|
-
return converterHelper(
|
|
524
|
-
FIXES[normalizeKey(ctorName2)] ?? FIXES[normalizeKey(ctorName2.replace(/\s+/g, ""))] ?? ctorName2,
|
|
525
|
-
formatCase
|
|
526
|
-
);
|
|
527
|
-
}
|
|
528
|
-
if (isNull(Object.getPrototypeOf(value))) {
|
|
529
|
-
return converterHelper(FIXES[normalizeKey("object")] ?? "Object", formatCase);
|
|
530
|
-
}
|
|
531
|
-
const tag = Object.prototype.toString.call(value).slice(8, -1) || "Object";
|
|
532
|
-
const mapped = FIXES[normalizeKey(tag)];
|
|
533
|
-
if (mapped) return converterHelper(mapped, formatCase);
|
|
534
|
-
const ctorName = value?.constructor?.name;
|
|
535
|
-
if (ctorName && ctorName !== "Object") {
|
|
536
|
-
return converterHelper(FIXES[normalizeKey(ctorName)] ?? ctorName, formatCase);
|
|
537
|
-
}
|
|
538
|
-
return converterHelper(tag, formatCase);
|
|
539
|
-
};
|
|
540
|
-
var determineErrorTypeAssertion = (type, message) => {
|
|
541
|
-
switch (type) {
|
|
542
|
-
case "Error":
|
|
543
|
-
throw new Error(message);
|
|
544
|
-
case "EvalError":
|
|
545
|
-
throw new EvalError(message);
|
|
546
|
-
case "RangeError":
|
|
547
|
-
throw new RangeError(message);
|
|
548
|
-
case "ReferenceError":
|
|
549
|
-
throw new ReferenceError(message);
|
|
550
|
-
case "SyntaxError":
|
|
551
|
-
throw new SyntaxError(message);
|
|
552
|
-
case "URIError":
|
|
553
|
-
throw new URIError(message);
|
|
554
|
-
case "TypeError":
|
|
555
|
-
throw new TypeError(message);
|
|
556
|
-
default:
|
|
557
|
-
throw new TypeError(message);
|
|
558
|
-
}
|
|
559
|
-
};
|
|
560
|
-
function resolveErrorMessageAssertions(params) {
|
|
561
|
-
const { requiredValidType, value, options } = params || {};
|
|
562
|
-
const {
|
|
563
|
-
message,
|
|
564
|
-
formatCase,
|
|
565
|
-
errorType = "TypeError"
|
|
566
|
-
} = isPlainObject(options) ? options : {};
|
|
567
|
-
const validType2 = toKebabCase(requiredValidType);
|
|
568
|
-
const currentType = getPreciseType(value, { formatCase });
|
|
569
|
-
const messageFnOptions = { currentType, validType: validType2 };
|
|
570
|
-
const defaultMessage = `Parameter input (\`value\`) must be of type \`${validType2}\`, but received: \`${currentType}\`.`;
|
|
571
|
-
const errorMessage = isFunction(message) ? isNonEmptyString(message(messageFnOptions)) ? message(messageFnOptions).trim() : defaultMessage : isNonEmptyString(message) ? message.trim() : defaultMessage;
|
|
572
|
-
return determineErrorTypeAssertion(errorType, errorMessage);
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
function assertIsPlainObject(value, options = {}) {
|
|
576
|
-
if (isPlainObject(value)) return;
|
|
577
|
-
resolveErrorMessageAssertions({
|
|
578
|
-
value,
|
|
579
|
-
options,
|
|
580
|
-
requiredValidType: "plain object"
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
export { assertIsBoolean, assertIsPlainObject, getPreciseType, hasOwnProp, isArray, isBoolean, isBooleanObject, isBuffer, isError, isFunction, isInfinityNumber, isNaN, isNil, isNonEmptyArray, isNonEmptyString, isNull, isNumber, isNumberObject, isObject, isObjectOrArray, isPlainObject, isSet, isString, isStringObject, isSymbol, isUndefined, resolveErrorMessageAssertions, slugify, toCamelCase, toDotCase, toKebabCase, toLowerCase, toPascalCase, toPascalCaseSpace, toSnakeCase };
|