@tempots/std 0.13.0 → 0.14.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/array.cjs +1 -1
- package/array.d.ts +35 -35
- package/array.js +108 -167
- package/async-result.d.ts +15 -15
- package/bigint.cjs +1 -1
- package/bigint.d.ts +20 -20
- package/bigint.js +37 -78
- package/boolean.cjs +1 -1
- package/boolean.d.ts +5 -5
- package/boolean.js +10 -19
- package/equal.cjs +1 -1
- package/equal.d.ts +3 -3
- package/equal.js +31 -37
- package/error.cjs +1 -0
- package/error.d.ts +24 -0
- package/error.js +26 -0
- package/function.cjs +1 -1
- package/function.d.ts +3 -3
- package/function.js +4 -10
- package/index.cjs +1 -1
- package/index.d.ts +1 -0
- package/index.js +116 -114
- package/number.cjs +1 -1
- package/number.d.ts +25 -46
- package/number.js +29 -86
- package/object.cjs +1 -1
- package/object.d.ts +6 -6
- package/object.js +12 -27
- package/package.json +15 -1
- package/promise.cjs +1 -0
- package/promise.d.ts +11 -0
- package/promise.js +9 -0
- package/regexp.cjs +1 -1
- package/regexp.d.ts +1 -1
- package/regexp.js +8 -8
- package/result.d.ts +8 -8
- package/string.cjs +4 -4
- package/string.d.ts +85 -89
- package/string.js +193 -379
- package/validation.d.ts +7 -7
package/string.js
CHANGED
|
@@ -1,392 +1,206 @@
|
|
|
1
|
-
import { anyElement as l, allElements as b, generateArray as
|
|
1
|
+
import { anyElement as l, allElements as b, generateArray as S, createFilledArray as O } from "./array.js";
|
|
2
|
+
import { MissingImplementationError as A } from "./error.js";
|
|
2
3
|
import { mapRegExp as h } from "./regexp.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
return
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return n.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return
|
|
80
|
-
}
|
|
81
|
-
function gn(n, t) {
|
|
82
|
-
return b(t, (r) => L(n, r));
|
|
83
|
-
}
|
|
84
|
-
function an(n, t) {
|
|
85
|
-
return b(t, (r) => g(n, r));
|
|
86
|
-
}
|
|
87
|
-
function hn(n) {
|
|
88
|
-
return n.replace("_", "-");
|
|
89
|
-
}
|
|
90
|
-
function pn(n, t) {
|
|
91
|
-
if (n === t) return -1;
|
|
92
|
-
const r = Math.min(n.length, t.length);
|
|
93
|
-
for (let e = 0; e < r; e++)
|
|
94
|
-
if (n.substring(e, e + 1) !== t.substring(e, e + 1)) return e;
|
|
95
|
-
return r;
|
|
96
|
-
}
|
|
97
|
-
function O(n, t = 20, r = "…") {
|
|
98
|
-
const e = n.length, i = r.length;
|
|
99
|
-
return e > t ? t < i ? r.substr(i - t, t) : n.substr(0, t - i) + r : n;
|
|
100
|
-
}
|
|
101
|
-
function dn(n, t = 20, r = "…") {
|
|
102
|
-
const e = n.length, i = r.length;
|
|
103
|
-
if (e > t) {
|
|
104
|
-
if (t <= i)
|
|
105
|
-
return O(n, t, r);
|
|
106
|
-
const u = Math.ceil((t - i) / 2), f = Math.floor((t - i) / 2);
|
|
107
|
-
return n.substr(0, u) + r + n.substr(e - f, f);
|
|
108
|
-
} else return n;
|
|
109
|
-
}
|
|
110
|
-
function W(n, t) {
|
|
111
|
-
return l(t, (r) => S(n, r));
|
|
112
|
-
}
|
|
113
|
-
function Cn(n, t) {
|
|
114
|
-
return a(n).filter(t).join("");
|
|
115
|
-
}
|
|
116
|
-
function bn(n, t) {
|
|
117
|
-
return F(n).filter(t).map((e) => String.fromCharCode(e)).join("");
|
|
118
|
-
}
|
|
119
|
-
function An(n, t = 2166136261) {
|
|
120
|
-
let r = t;
|
|
121
|
-
for (let e = 0, i = n.length; e < i; e++)
|
|
122
|
-
r ^= n.charCodeAt(e), r += (r << 1) + (r << 4) + (r << 7) + (r << 8) + (r << 24);
|
|
123
|
-
return r >>> 0;
|
|
124
|
-
}
|
|
125
|
-
function Sn(n) {
|
|
126
|
-
return n != null && n.length > 0;
|
|
127
|
-
}
|
|
128
|
-
function Ln(n) {
|
|
129
|
-
return c(U(n), "_", " ");
|
|
130
|
-
}
|
|
131
|
-
function xn(n) {
|
|
132
|
-
return n.length > 0 && !D.test(n);
|
|
133
|
-
}
|
|
134
|
-
function wn(n) {
|
|
135
|
-
return R.test(n);
|
|
136
|
-
}
|
|
137
|
-
function mn(n) {
|
|
138
|
-
return !Z.test(n);
|
|
139
|
-
}
|
|
140
|
-
function In(n) {
|
|
141
|
-
return n.toLowerCase() === n;
|
|
142
|
-
}
|
|
143
|
-
function Tn(n) {
|
|
144
|
-
return n.toUpperCase() === n;
|
|
145
|
-
}
|
|
146
|
-
function En(n, t) {
|
|
147
|
-
return n != null && n !== "" ? n : t;
|
|
148
|
-
}
|
|
149
|
-
function On(n) {
|
|
150
|
-
return G.test(n);
|
|
151
|
-
}
|
|
152
|
-
function Wn(n) {
|
|
153
|
-
return n == null || n === "";
|
|
154
|
-
}
|
|
155
|
-
function yn(n) {
|
|
156
|
-
return n.substring(0, 1).toLowerCase() + n.substring(1);
|
|
157
|
-
}
|
|
158
|
-
function y(n, t = 1) {
|
|
159
|
-
return n.substring(
|
|
160
|
-
Math.floor((n.length - t + 1) * Math.random()),
|
|
161
|
-
t
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
function z(n, t) {
|
|
165
|
-
return A(t, () => y(n)).join("");
|
|
166
|
-
}
|
|
167
|
-
function zn(n) {
|
|
168
|
-
return z(k, n);
|
|
169
|
-
}
|
|
170
|
-
function Bn(n, t) {
|
|
171
|
-
return a(t).map(n);
|
|
172
|
-
}
|
|
173
|
-
function jn(n, t) {
|
|
174
|
-
return c(n, t, "");
|
|
175
|
-
}
|
|
176
|
-
function _n(n, t) {
|
|
177
|
-
return S(n, t) ? n.substring(0, n.length - t.length) : n;
|
|
178
|
-
}
|
|
179
|
-
function Fn(n, t, r) {
|
|
180
|
-
return n.substring(0, t) + n.substring(t + r);
|
|
181
|
-
}
|
|
182
|
-
function Mn(n, t) {
|
|
183
|
-
return T(n, t) ? n.substring(t.length) : n;
|
|
184
|
-
}
|
|
185
|
-
function Nn(n, t) {
|
|
186
|
-
const r = n.indexOf(t);
|
|
187
|
-
return r < 0 ? n : n.substring(0, r) + n.substring(r + t.length);
|
|
188
|
-
}
|
|
189
|
-
function x(n, t) {
|
|
190
|
-
return I(t, n).join("");
|
|
191
|
-
}
|
|
192
|
-
function Un(n) {
|
|
193
|
-
const t = a(n);
|
|
194
|
-
return t.reverse(), t.join("");
|
|
195
|
-
}
|
|
196
|
-
function B(n, t = "'") {
|
|
197
|
-
return t === "'" ? n.includes("'") ? n.includes('"') ? "'" + c(n, "'", "\\'") + "'" : '"' + n + '"' : "'" + n + "'" : n.includes('"') ? n.includes("'") ? '"' + c(n, '"', '\\"') + '"' : "'" + n + "'" : '"' + n + '"';
|
|
198
|
-
}
|
|
199
|
-
function j(n, t = "'") {
|
|
200
|
-
return t + c(n, t, "\\" + t) + t;
|
|
201
|
-
}
|
|
202
|
-
function $n(n, t = "'") {
|
|
203
|
-
return n.indexOf(`
|
|
204
|
-
`) >= 0 ? j(n, "`") : B(n, t);
|
|
205
|
-
}
|
|
206
|
-
function kn(n, t) {
|
|
207
|
-
const r = n.indexOf(t);
|
|
208
|
-
return r < 0 ? [n] : [n.substring(0, r), n.substring(r + t.length)];
|
|
209
|
-
}
|
|
210
|
-
function _(n, t) {
|
|
211
|
-
return l(t, (r) => n.startsWith(r));
|
|
212
|
-
}
|
|
213
|
-
function Hn(n, t, r = t) {
|
|
214
|
-
return `${t}${n}${r}`;
|
|
215
|
-
}
|
|
216
|
-
function a(n) {
|
|
217
|
-
return n.split("");
|
|
218
|
-
}
|
|
219
|
-
function F(n) {
|
|
220
|
-
return A(n.length, (t) => n.charCodeAt(t));
|
|
221
|
-
}
|
|
222
|
-
function Zn(n, t) {
|
|
223
|
-
const r = [];
|
|
224
|
-
for (; n.length > 0; )
|
|
225
|
-
r.push(n.substring(0, t)), n = n.substr(t, n.length - t);
|
|
226
|
-
return r;
|
|
227
|
-
}
|
|
228
|
-
function Dn(n) {
|
|
229
|
-
return n.split(m);
|
|
230
|
-
}
|
|
231
|
-
function Pn(n, t) {
|
|
232
|
-
return N(M(n, t), t);
|
|
233
|
-
}
|
|
234
|
-
function M(n, t) {
|
|
235
|
-
let r = 0;
|
|
236
|
-
for (let e = 0; e < n.length && g(t, n.charAt(e)); e++)
|
|
237
|
-
r++;
|
|
238
|
-
return n.substring(r);
|
|
239
|
-
}
|
|
240
|
-
function N(n, t) {
|
|
241
|
-
const r = n.length;
|
|
242
|
-
let e = r, i;
|
|
243
|
-
for (let u = 0; u < r && (i = r - u - 1, g(t, n.charAt(i))); u++)
|
|
244
|
-
e = i;
|
|
245
|
-
return n.substring(0, e);
|
|
246
|
-
}
|
|
247
|
-
function U(n) {
|
|
248
|
-
return n = n.replace(/::/g, "/"), n = n.replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2"), n = n.replace(/([a-z\d])([A-Z])/g, "$1_$2"), n = n.replace(/-/g, "_"), n.toLowerCase();
|
|
249
|
-
}
|
|
250
|
-
function Rn(n) {
|
|
251
|
-
return n.substring(0, 1).toUpperCase() + n.substring(1);
|
|
252
|
-
}
|
|
253
|
-
function Gn(n, t = 78, r = "", e = `
|
|
254
|
-
`) {
|
|
255
|
-
return n.split(m).map(
|
|
256
|
-
(i) => $(i.replace(w, " ").trim(), t, r, e)
|
|
257
|
-
).join(e);
|
|
258
|
-
}
|
|
259
|
-
function C(n, t) {
|
|
260
|
-
if (t < 0 || t >= n.length) return !1;
|
|
261
|
-
const r = n.charCodeAt(t);
|
|
262
|
-
return r === 9 || r === 10 || r === 11 || r === 12 || r === 13 || r === 32;
|
|
263
|
-
}
|
|
264
|
-
function Qn(n) {
|
|
4
|
+
const u = (t, n, e) => t.split(n).join(e), X = (t, n) => {
|
|
5
|
+
const e = t.indexOf(n);
|
|
6
|
+
return e < 0 ? "" : t.substring(e + n.length);
|
|
7
|
+
}, Y = (t, n) => {
|
|
8
|
+
const e = t.lastIndexOf(n);
|
|
9
|
+
return e < 0 ? "" : t.substring(e + n.length);
|
|
10
|
+
}, v = (t, n) => {
|
|
11
|
+
const e = t.indexOf(n);
|
|
12
|
+
return e < 0 ? "" : t.substring(0, e);
|
|
13
|
+
}, tt = (t, n) => {
|
|
14
|
+
const e = t.lastIndexOf(n);
|
|
15
|
+
return e < 0 ? "" : t.substring(0, e);
|
|
16
|
+
}, p = (t) => t.substring(0, 1).toUpperCase() + t.substring(1), d = (t) => t.toUpperCase(), nt = (t, n = !1) => n ? h(p(t), F, d) : h(p(t), D, d), et = (t) => t.replace(K, `
|
|
17
|
+
`), rt = (t, n) => t == null && n == null ? 0 : t == null ? -1 : n == null ? 1 : W(t.toLowerCase(), n.toLowerCase()), L = (t, n) => t.substring(0, t.length - n.length) === n, st = (t, n) => t.substring(0, t.length - n.length).toLowerCase() === n.toLowerCase(), x = (t, n) => t.substring(0, n.length) === n, it = (t, n) => t.substring(0, n.length).toLowerCase() === n.toLowerCase(), ot = (t, n) => B(
|
|
18
|
+
t.toLowerCase(),
|
|
19
|
+
n.map((e) => e.toLowerCase())
|
|
20
|
+
), ct = (t, n) => M(
|
|
21
|
+
t.toLowerCase(),
|
|
22
|
+
n.map((e) => e.toLowerCase())
|
|
23
|
+
), ut = (t) => t.trim().replace(m, " "), W = (t, n) => t < n ? -1 : t > n ? 1 : 0, w = (t, n) => t.toLowerCase().includes(n.toLowerCase()), a = (t, n) => t.includes(n), gt = (t, n) => t.split(n).length - 1, lt = (t, n) => l(n, (e) => w(t, e)), at = (t, n) => l(n, (e) => a(t, e)), ft = (t, n) => b(n, (e) => w(t, e)), ht = (t, n) => b(n, (e) => a(t, e)), pt = (t) => t.replace("_", "-"), dt = (t, n) => {
|
|
24
|
+
if (t === n) return -1;
|
|
25
|
+
const e = Math.min(t.length, n.length);
|
|
26
|
+
for (let r = 0; r < e; r++)
|
|
27
|
+
if (t.substring(r, r + 1) !== n.substring(r, r + 1)) return r;
|
|
28
|
+
return e;
|
|
29
|
+
}, y = (t, n = 20, e = "…") => {
|
|
30
|
+
const r = t.length, s = e.length;
|
|
31
|
+
return r > n ? n < s ? e.slice(s - n, n) : t.slice(0, n - s) + e : t;
|
|
32
|
+
}, Ct = (t, n = 20, e = "…") => {
|
|
33
|
+
const r = t.length, s = e.length;
|
|
34
|
+
if (r > n) {
|
|
35
|
+
if (n <= s)
|
|
36
|
+
return y(t, n, e);
|
|
37
|
+
const c = Math.ceil((n - s) / 2), g = Math.floor((n - s) / 2);
|
|
38
|
+
return t.slice(0, c) + e + t.slice(r - g);
|
|
39
|
+
} else return t;
|
|
40
|
+
}, B = (t, n) => l(n, (e) => L(t, e)), bt = (t, n) => f(t).filter(n).join(""), St = (t, n) => _(t).filter(n).map((r) => String.fromCharCode(r)).join(""), At = (t, n = 2166136261) => {
|
|
41
|
+
let e = n;
|
|
42
|
+
for (let r = 0, s = t.length; r < s; r++)
|
|
43
|
+
e ^= t.charCodeAt(r), e += (e << 1) + (e << 4) + (e << 7) + (e << 8) + (e << 24);
|
|
44
|
+
return e >>> 0;
|
|
45
|
+
}, Lt = (t) => t != null && t.length > 0, wt = (t) => u(k(t), "_", " "), It = (t) => t.length > 0 && !R.test(t), mt = (t) => G.test(t), Et = (t) => !P.test(t), Ot = (t) => t.toLowerCase() === t, xt = (t) => t.toUpperCase() === t, Wt = (t, n) => t != null && t !== "" ? t : n, yt = (t) => Q.test(t), Bt = (t) => t == null || t === "", zt = (t) => t.substring(0, 1).toLowerCase() + t.substring(1), z = (t, n = 1) => t.substring(
|
|
46
|
+
Math.floor((t.length - n + 1) * Math.random()),
|
|
47
|
+
n
|
|
48
|
+
), T = (t, n) => S(n, () => z(t)).join(""), Tt = (t) => T(Z, t), jt = (t, n) => f(n).map(t), Nt = (t, n) => u(t, n, ""), Mt = (t, n) => L(t, n) ? t.substring(0, t.length - n.length) : t, _t = (t, n, e) => t.substring(0, n) + t.substring(n + e), Ut = (t, n) => x(t, n) ? t.substring(n.length) : t, $t = (t, n) => {
|
|
49
|
+
const e = t.indexOf(n);
|
|
50
|
+
return e < 0 ? t : t.substring(0, e) + t.substring(e + n.length);
|
|
51
|
+
}, I = (t, n) => O(n, t).join(""), kt = (t) => {
|
|
52
|
+
const n = f(t);
|
|
53
|
+
return n.reverse(), n.join("");
|
|
54
|
+
}, j = (t, n = "'") => n === "'" ? t.includes("'") ? t.includes('"') ? "'" + u(t, "'", "\\'") + "'" : '"' + t + '"' : "'" + t + "'" : t.includes('"') ? t.includes("'") ? '"' + u(t, '"', '\\"') + '"' : "'" + t + "'" : '"' + t + '"', N = (t, n = "'") => n + u(t, n, "\\" + n) + n, Ht = (t, n = "'") => t.indexOf(`
|
|
55
|
+
`) >= 0 ? N(t, "`") : j(t, n), Zt = (t, n) => {
|
|
56
|
+
const e = t.indexOf(n);
|
|
57
|
+
return e < 0 ? [t] : [t.substring(0, e), t.substring(e + n.length)];
|
|
58
|
+
}, M = (t, n) => l(n, (e) => t.startsWith(e)), Dt = (t, n, e = n) => `${n}${t}${e}`, f = (t) => t.split(""), _ = (t) => S(t.length, (n) => t.charCodeAt(n)), Pt = (t, n) => {
|
|
59
|
+
const e = [];
|
|
60
|
+
for (; t.length > 0; )
|
|
61
|
+
e.push(t.substring(0, n)), t = t.substring(n, t.length - n);
|
|
62
|
+
return e;
|
|
63
|
+
}, Rt = (t) => t.split(E), Ft = (t, n) => $(U(t, n), n), U = (t, n) => {
|
|
64
|
+
let e = 0;
|
|
65
|
+
for (let r = 0; r < t.length && a(n, t.charAt(r)); r++)
|
|
66
|
+
e++;
|
|
67
|
+
return t.substring(e);
|
|
68
|
+
}, $ = (t, n) => {
|
|
69
|
+
const e = t.length;
|
|
70
|
+
let r = e, s;
|
|
71
|
+
for (let c = 0; c < e && (s = e - c - 1, a(n, t.charAt(s))); c++)
|
|
72
|
+
r = s;
|
|
73
|
+
return t.substring(0, r);
|
|
74
|
+
}, k = (t) => (t = t.replace(/::/g, "/"), t = t.replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2"), t = t.replace(/([a-z\d])([A-Z])/g, "$1_$2"), t = t.replace(/-/g, "_"), t.toLowerCase()), Gt = (t) => t.substring(0, 1).toUpperCase() + t.substring(1), Qt = (t, n = 78, e = "", r = `
|
|
75
|
+
`) => t.split(E).map(
|
|
76
|
+
(s) => H(s.replace(m, " ").trim(), n, e, r)
|
|
77
|
+
).join(r), C = (t, n) => {
|
|
78
|
+
if (n < 0 || n >= t.length) return !1;
|
|
79
|
+
const e = t.charCodeAt(n);
|
|
80
|
+
return e === 9 || e === 10 || e === 11 || e === 12 || e === 13 || e === 32;
|
|
81
|
+
}, Kt = (t) => {
|
|
265
82
|
if (typeof Buffer < "u")
|
|
266
|
-
return Buffer.from(
|
|
83
|
+
return Buffer.from(t).toString("base64");
|
|
267
84
|
if (typeof btoa < "u")
|
|
268
|
-
return btoa(
|
|
269
|
-
throw new
|
|
270
|
-
|
|
271
|
-
|
|
85
|
+
return btoa(t);
|
|
86
|
+
throw new A(
|
|
87
|
+
"No implementation found for base64 encoding"
|
|
88
|
+
);
|
|
89
|
+
}, qt = (t) => {
|
|
272
90
|
if (typeof Buffer < "u")
|
|
273
|
-
return Buffer.from(
|
|
91
|
+
return Buffer.from(t, "base64").toString("utf8");
|
|
274
92
|
if (typeof atob < "u")
|
|
275
|
-
return atob(
|
|
276
|
-
throw new
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
93
|
+
return atob(t);
|
|
94
|
+
throw new A(
|
|
95
|
+
"No implementation found for base64 decoding"
|
|
96
|
+
);
|
|
97
|
+
}, H = (t, n, e, r) => {
|
|
98
|
+
const s = [], c = t.length, g = e.length;
|
|
99
|
+
let o = 0;
|
|
100
|
+
for (n -= g; ; ) {
|
|
101
|
+
if (o + n >= c - g) {
|
|
102
|
+
s.push(t.substring(o));
|
|
284
103
|
break;
|
|
285
104
|
}
|
|
286
|
-
let
|
|
287
|
-
for (; !C(
|
|
288
|
-
if (
|
|
289
|
-
for (
|
|
290
|
-
|
|
105
|
+
let i = 0;
|
|
106
|
+
for (; !C(t, o + n - i) && i < n; ) i++;
|
|
107
|
+
if (i === n) {
|
|
108
|
+
for (i = 0; !C(t, o + n + i) && o + n + i < c; ) i++;
|
|
109
|
+
s.push(t.substring(o, o + n + i)), o += n + i + 1;
|
|
291
110
|
} else
|
|
292
|
-
|
|
111
|
+
s.push(t.substring(o, o + n - i)), o += n - i + 1;
|
|
293
112
|
}
|
|
294
|
-
return
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
const
|
|
306
|
-
return
|
|
307
|
-
}
|
|
308
|
-
function Xn(n, t) {
|
|
309
|
-
const r = n.indexOf(t);
|
|
310
|
-
return r >= 0 ? [n.substring(0, r), n.substring(r + t.length)] : [n];
|
|
311
|
-
}
|
|
312
|
-
const k = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", H = /[^a-zA-Z]([a-z])/g, Z = /[^\t\n\r ]/, D = /[^a-zA-Z]/, P = /[ \t\r\n][a-z]/g, R = /^[a-z0-9]+$/i, G = /^[0-9]+$/, w = /[ \t\r\n]+/g, m = /\r\n|\n\r|\n|\r/g, Q = /\r\n|\n\r|\r/g;
|
|
113
|
+
return e + s.join(r + e);
|
|
114
|
+
}, Jt = (t, n, e) => {
|
|
115
|
+
const r = e - t.length;
|
|
116
|
+
return r > 0 ? I(n, r) + t : t;
|
|
117
|
+
}, Vt = (t, n, e) => {
|
|
118
|
+
const r = e - t.length;
|
|
119
|
+
return r > 0 ? t + I(n, r) : t;
|
|
120
|
+
}, Xt = (t, n) => {
|
|
121
|
+
const e = t.lastIndexOf(n);
|
|
122
|
+
return e >= 0 ? [t.substring(0, e), t.substring(e + n.length)] : [t];
|
|
123
|
+
}, Yt = (t, n) => {
|
|
124
|
+
const e = t.indexOf(n);
|
|
125
|
+
return e >= 0 ? [t.substring(0, e), t.substring(e + n.length)] : [t];
|
|
126
|
+
}, Z = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", D = /[^a-zA-Z]([a-z])/g, P = /[^\t\n\r ]/, R = /[^a-zA-Z]/, F = /[ \t\r\n][a-z]/g, G = /^[a-z0-9]+$/i, Q = /^[0-9]+$/, m = /[ \t\r\n]+/g, E = /\r\n|\n\r|\n|\r/g, K = /\r\n|\n\r|\r/g;
|
|
313
127
|
export {
|
|
314
|
-
|
|
315
|
-
J as afterText,
|
|
316
|
-
Y as beforeLastText,
|
|
317
|
-
X as beforeText,
|
|
318
|
-
nn as canonicalizeNewlines,
|
|
128
|
+
et as canonicalizeNewlines,
|
|
319
129
|
p as capitalize,
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
130
|
+
nt as capitalizeWords,
|
|
131
|
+
Pt as chunkString,
|
|
132
|
+
ut as collapseText,
|
|
133
|
+
rt as compareCaseInsensitive,
|
|
134
|
+
W as compareStrings,
|
|
135
|
+
ht as containsAllText,
|
|
136
|
+
ft as containsAllTextCaseInsensitive,
|
|
137
|
+
at as containsAnyText,
|
|
138
|
+
lt as containsAnyTextCaseInsensitive,
|
|
139
|
+
gt as countStringOccurrences,
|
|
140
|
+
pt as dasherize,
|
|
141
|
+
qt as decodeBase64,
|
|
142
|
+
$t as deleteFirstFromString,
|
|
143
|
+
Mt as deleteStringAfter,
|
|
144
|
+
Ut as deleteStringBefore,
|
|
145
|
+
Nt as deleteSubstring,
|
|
146
|
+
y as ellipsis,
|
|
147
|
+
Ct as ellipsisMiddle,
|
|
148
|
+
Kt as encodeBase64,
|
|
149
|
+
St as filterCharcodes,
|
|
150
|
+
bt as filterChars,
|
|
151
|
+
wt as humanize,
|
|
152
|
+
Wt as ifEmptyString,
|
|
153
|
+
It as isAlpha,
|
|
154
|
+
mt as isAlphaNum,
|
|
155
|
+
Et as isBreakingWhitespace,
|
|
156
|
+
yt as isDigitsOnly,
|
|
157
|
+
Bt as isEmptyString,
|
|
158
|
+
Ot as isLowerCase,
|
|
345
159
|
C as isSpaceAt,
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
160
|
+
xt as isUpperCase,
|
|
161
|
+
Ht as jsQuote,
|
|
162
|
+
zt as lowerCaseFirst,
|
|
163
|
+
Jt as lpad,
|
|
164
|
+
jt as mapChars,
|
|
165
|
+
N as quote,
|
|
166
|
+
z as randomString,
|
|
167
|
+
T as randomStringSequence,
|
|
168
|
+
Tt as randomStringSequenceBase64,
|
|
169
|
+
I as repeatString,
|
|
170
|
+
u as replaceAll,
|
|
171
|
+
kt as reverseString,
|
|
172
|
+
Vt as rpad,
|
|
173
|
+
j as smartQuote,
|
|
174
|
+
Yt as splitStringOnFirst,
|
|
175
|
+
Xt as splitStringOnLast,
|
|
176
|
+
Zt as splitStringOnce,
|
|
177
|
+
a as stringContains,
|
|
178
|
+
L as stringEndsWith,
|
|
179
|
+
B as stringEndsWithAny,
|
|
180
|
+
Lt as stringHasContent,
|
|
181
|
+
At as stringHashCode,
|
|
182
|
+
x as stringStartsWith,
|
|
183
|
+
M as stringStartsWithAny,
|
|
184
|
+
_ as stringToCharcodes,
|
|
185
|
+
f as stringToChars,
|
|
186
|
+
dt as stringsDifferAtIndex,
|
|
187
|
+
X as substringAfter,
|
|
188
|
+
Y as substringAfterLast,
|
|
189
|
+
v as substringBefore,
|
|
190
|
+
tt as substringBeforeLast,
|
|
191
|
+
Dt as surroundString,
|
|
192
|
+
w as textContainsCaseInsensitive,
|
|
193
|
+
ot as textEndsWithAnyCaseInsensitive,
|
|
194
|
+
st as textEndsWithCaseInsensitive,
|
|
195
|
+
ct as textStartsWithAnyCaseInsensitive,
|
|
196
|
+
it as textStartsWithCaseInsensitive,
|
|
197
|
+
Rt as textToLines,
|
|
198
|
+
Ft as trimChars,
|
|
199
|
+
U as trimCharsLeft,
|
|
200
|
+
$ as trimCharsRight,
|
|
201
|
+
_t as trimStringSlice,
|
|
202
|
+
k as underscore,
|
|
203
|
+
Gt as upperCaseFirst,
|
|
204
|
+
Qt as wrapColumns,
|
|
205
|
+
H as wrapLine
|
|
392
206
|
};
|
package/validation.d.ts
CHANGED
|
@@ -4,18 +4,18 @@ import { Result } from './result';
|
|
|
4
4
|
* Represents a valid result.
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
8
|
-
type: 'valid';
|
|
9
|
-
}
|
|
7
|
+
export type Valid = {
|
|
8
|
+
readonly type: 'valid';
|
|
9
|
+
};
|
|
10
10
|
/**
|
|
11
11
|
* Represents an invalid value with an associated error.
|
|
12
12
|
* @typeParam E - The type of the error.
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
16
|
-
type: 'invalid';
|
|
17
|
-
error: E;
|
|
18
|
-
}
|
|
15
|
+
export type Invalid<E> = {
|
|
16
|
+
readonly type: 'invalid';
|
|
17
|
+
readonly error: E;
|
|
18
|
+
};
|
|
19
19
|
/**
|
|
20
20
|
* Represents a type that can either be `Valid` or `Invalid`.
|
|
21
21
|
* @typeParam E - The type of the error associated with an `Invalid` value.
|