@tempots/std 0.20.0 → 0.22.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 +124 -284
- package/array.js +108 -128
- package/date.cjs +1 -0
- package/date.d.ts +393 -0
- package/date.js +49 -0
- package/function.cjs +1 -1
- package/function.d.ts +145 -0
- package/function.js +35 -5
- package/index.cjs +1 -1
- package/index.d.ts +6 -0
- package/index.js +271 -200
- package/iterator.cjs +1 -0
- package/iterator.d.ts +219 -0
- package/iterator.js +69 -0
- package/json.cjs +1 -1
- package/json.d.ts +40 -2
- package/json.js +7 -6
- package/map.cjs +1 -0
- package/map.d.ts +202 -0
- package/map.js +41 -0
- package/number.cjs +1 -1
- package/number.d.ts +16 -25
- package/number.js +26 -27
- package/object.cjs +1 -1
- package/object.d.ts +146 -8
- package/object.js +42 -15
- package/package.json +43 -1
- package/random.cjs +1 -0
- package/random.d.ts +200 -0
- package/random.js +72 -0
- package/set.cjs +1 -0
- package/set.d.ts +227 -0
- package/set.js +52 -0
- package/string.cjs +4 -4
- package/string.d.ts +2 -60
- package/string.js +122 -129
- package/url.cjs +1 -0
- package/url.d.ts +232 -0
- package/url.js +79 -0
package/string.d.ts
CHANGED
|
@@ -4,15 +4,6 @@
|
|
|
4
4
|
* Use by importing the desired utility from "@tempots/std" or directly from "@tempots/std/string".
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
|
-
/**
|
|
8
|
-
* Replaces all occurrances of `placeholder` in `subject` with the value `replacement`.
|
|
9
|
-
* @param subject - The string to search in.
|
|
10
|
-
* @param placeholder - The string to search for.
|
|
11
|
-
* @param replacement - The string to replace `placeholder` with.
|
|
12
|
-
* @returns The string with all occurrances of `placeholder` replaced by `replacement`.
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export declare const replaceAll: (subject: string, placeholder: string, replacement: string) => string;
|
|
16
7
|
/**
|
|
17
8
|
* `substringAfter` searches for the first occurrance of `searchFor` and returns the text after that.
|
|
18
9
|
* If `searchFor` is not found, an empty string is returned.
|
|
@@ -87,16 +78,7 @@ export declare const canonicalizeNewlines: (value: string) => string;
|
|
|
87
78
|
* @returns A negative number if `a` is less than `b`, zero if they are equal, or a positive number if `a` is greater than `b`.
|
|
88
79
|
* @public
|
|
89
80
|
*/
|
|
90
|
-
export declare const compareCaseInsensitive: (a: string, b: string) => number;
|
|
91
|
-
/**
|
|
92
|
-
* Checks if a string ends with a specified suffix.
|
|
93
|
-
*
|
|
94
|
-
* @param s - The string to check.
|
|
95
|
-
* @param end - The suffix to check against.
|
|
96
|
-
* @returns `true` if the string ends with the specified suffix, `false` otherwise.
|
|
97
|
-
* @public
|
|
98
|
-
*/
|
|
99
|
-
export declare const stringEndsWith: (s: string, end: string) => boolean;
|
|
81
|
+
export declare const compareCaseInsensitive: (a: string | null | undefined, b: string | null | undefined) => number;
|
|
100
82
|
/**
|
|
101
83
|
* Checks if a string ends with another string in a case-insensitive manner.
|
|
102
84
|
*
|
|
@@ -106,15 +88,6 @@ export declare const stringEndsWith: (s: string, end: string) => boolean;
|
|
|
106
88
|
* @public
|
|
107
89
|
*/
|
|
108
90
|
export declare const textEndsWithCaseInsensitive: (s: string, end: string) => boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Checks if a string starts with a specified substring.
|
|
111
|
-
*
|
|
112
|
-
* @param s - The string to check.
|
|
113
|
-
* @param start - The substring to check for at the beginning of the string.
|
|
114
|
-
* @returns `true` if the string starts with the specified substring, `false` otherwise.
|
|
115
|
-
* @public
|
|
116
|
-
*/
|
|
117
|
-
export declare const stringStartsWith: (s: string, start: string) => boolean;
|
|
118
91
|
/**
|
|
119
92
|
* Checks if a string starts with another string in a case-insensitive manner.
|
|
120
93
|
*
|
|
@@ -172,15 +145,6 @@ export declare const compareStrings: (a: string, b: string) => number;
|
|
|
172
145
|
* @public
|
|
173
146
|
*/
|
|
174
147
|
export declare const textContainsCaseInsensitive: (s: string, test: string) => boolean;
|
|
175
|
-
/**
|
|
176
|
-
* `textContains` returns `true` if `s` contains one or more occurrences of `test`.
|
|
177
|
-
*
|
|
178
|
-
* @param s - The string to search in.
|
|
179
|
-
* @param test - The string to search for.
|
|
180
|
-
* @returns `true` if `s` contains `test`, `false` otherwise.
|
|
181
|
-
* @public
|
|
182
|
-
*/
|
|
183
|
-
export declare const stringContains: (s: string, test: string) => boolean;
|
|
184
148
|
/**
|
|
185
149
|
* Return the number of occurrences of `test` in `s`.
|
|
186
150
|
*
|
|
@@ -417,7 +381,7 @@ export declare const lowerCaseFirst: (value: string) => string;
|
|
|
417
381
|
* @returns The random substring.
|
|
418
382
|
* @public
|
|
419
383
|
*/
|
|
420
|
-
export declare const
|
|
384
|
+
export declare const randomSubString: (value: string, length?: number) => string;
|
|
421
385
|
/**
|
|
422
386
|
* Returns a random sampling of the specified length from the seed string.
|
|
423
387
|
*
|
|
@@ -490,20 +454,6 @@ export declare const deleteStringBefore: (value: string, toremove: string) => st
|
|
|
490
454
|
* @public
|
|
491
455
|
*/
|
|
492
456
|
export declare const deleteFirstFromString: (value: string, toremove: string) => string;
|
|
493
|
-
/**
|
|
494
|
-
* `repeatString` builds a new string by repeating the argument `s`, n `times`.
|
|
495
|
-
*
|
|
496
|
-
* @example
|
|
497
|
-
* ```ts
|
|
498
|
-
* repeatString('Xy', 3) // generates 'XyXyXy'
|
|
499
|
-
* ```
|
|
500
|
-
*
|
|
501
|
-
* @param s - The string to repeat.
|
|
502
|
-
* @param times - The number of times to repeat the string.
|
|
503
|
-
* @returns The repeated string.
|
|
504
|
-
* @public
|
|
505
|
-
*/
|
|
506
|
-
export declare const repeatString: (s: string, times: number) => string;
|
|
507
457
|
/**
|
|
508
458
|
* Returns a new string whose characters are in reverse order.
|
|
509
459
|
*
|
|
@@ -570,14 +520,6 @@ export declare const stringStartsWithAny: (s: string, values: string[]) => boole
|
|
|
570
520
|
* @public
|
|
571
521
|
*/
|
|
572
522
|
export declare const surroundString: (s: string, left: string, right?: string) => string;
|
|
573
|
-
/**
|
|
574
|
-
* It transforms a string into an `Array` of characters.
|
|
575
|
-
*
|
|
576
|
-
* @param s - The string to transform.
|
|
577
|
-
* @returns An array of characters.
|
|
578
|
-
* @public
|
|
579
|
-
*/
|
|
580
|
-
export declare const stringToChars: (s: string) => string[];
|
|
581
523
|
/**
|
|
582
524
|
* It transforms a string into an `Array` of char codes in integer format.
|
|
583
525
|
*
|
package/string.js
CHANGED
|
@@ -1,206 +1,199 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const u = (t, n, e) => t.split(n).join(e), X = (t, n) => {
|
|
1
|
+
import { MissingImplementationError as p } from "./error.js";
|
|
2
|
+
import { mapRegExp as l } from "./regexp.js";
|
|
3
|
+
const Z = (t, n) => {
|
|
5
4
|
const e = t.indexOf(n);
|
|
6
5
|
return e < 0 ? "" : t.substring(e + n.length);
|
|
7
|
-
},
|
|
6
|
+
}, D = (t, n) => {
|
|
8
7
|
const e = t.lastIndexOf(n);
|
|
9
8
|
return e < 0 ? "" : t.substring(e + n.length);
|
|
10
|
-
},
|
|
9
|
+
}, P = (t, n) => {
|
|
11
10
|
const e = t.indexOf(n);
|
|
12
11
|
return e < 0 ? "" : t.substring(0, e);
|
|
13
|
-
},
|
|
12
|
+
}, R = (t, n) => {
|
|
14
13
|
const e = t.lastIndexOf(n);
|
|
15
14
|
return e < 0 ? "" : t.substring(0, e);
|
|
16
|
-
},
|
|
17
|
-
`),
|
|
15
|
+
}, g = (t) => t.substring(0, 1).toUpperCase() + t.substring(1), f = (t) => t.toUpperCase(), F = (t, n = !1) => n ? l(g(t), _, f) : l(g(t), z, f), G = (t) => t.replace($, `
|
|
16
|
+
`), Q = (t, n) => t == null && n == null ? 0 : t == null ? -1 : n == null ? 1 : b(t.toLowerCase(), n.toLowerCase()), K = (t, n) => t.substring(t.length - n.length).toLowerCase() === n.toLowerCase(), q = (t, n) => t.substring(0, n.length).toLowerCase() === n.toLowerCase(), J = (t, n) => S(
|
|
18
17
|
t.toLowerCase(),
|
|
19
18
|
n.map((e) => e.toLowerCase())
|
|
20
|
-
),
|
|
19
|
+
), V = (t, n) => y(
|
|
21
20
|
t.toLowerCase(),
|
|
22
21
|
n.map((e) => e.toLowerCase())
|
|
23
|
-
),
|
|
22
|
+
), X = (t) => t.trim().replace(d, " "), b = (t, n) => t < n ? -1 : t > n ? 1 : 0, h = (t, n) => t.toLowerCase().includes(n.toLowerCase()), Y = (t, n) => t.split(n).length - 1, v = (t, n) => n.some((e) => h(t, e)), tt = (t, n) => n.some((e) => t.includes(e)), nt = (t, n) => n.every((e) => h(t, e)), et = (t, n) => n.every((e) => t.includes(e)), rt = (t) => t.replace(/_/g, "-"), st = (t, n) => {
|
|
24
23
|
if (t === n) return -1;
|
|
25
24
|
const e = Math.min(t.length, n.length);
|
|
26
25
|
for (let r = 0; r < e; r++)
|
|
27
26
|
if (t.substring(r, r + 1) !== n.substring(r, r + 1)) return r;
|
|
28
27
|
return e;
|
|
29
|
-
},
|
|
28
|
+
}, A = (t, n = 20, e = "…") => {
|
|
30
29
|
const r = t.length, s = e.length;
|
|
31
30
|
return r > n ? n < s ? e.slice(s - n, n) : t.slice(0, n - s) + e : t;
|
|
32
|
-
},
|
|
31
|
+
}, it = (t, n = 20, e = "…") => {
|
|
33
32
|
const r = t.length, s = e.length;
|
|
34
33
|
if (r > n) {
|
|
35
34
|
if (n <= s)
|
|
36
|
-
return
|
|
37
|
-
const c = Math.ceil((n - s) / 2),
|
|
38
|
-
return t.slice(0, c) + e + t.slice(r -
|
|
35
|
+
return A(t, n, e);
|
|
36
|
+
const c = Math.ceil((n - s) / 2), u = Math.floor((n - s) / 2);
|
|
37
|
+
return t.slice(0, c) + e + t.slice(r - u);
|
|
39
38
|
} else return t;
|
|
40
|
-
},
|
|
39
|
+
}, S = (t, n) => n.some((e) => t.endsWith(e)), ot = (t, n) => Array.from(t).filter(n).join(""), ct = (t, n) => x(t).filter(n).map((r) => String.fromCharCode(r)).join(""), ut = (t, n = 2166136261) => {
|
|
41
40
|
let e = n;
|
|
42
41
|
for (let r = 0, s = t.length; r < s; r++)
|
|
43
42
|
e ^= t.charCodeAt(r), e += (e << 1) + (e << 4) + (e << 7) + (e << 8) + (e << 24);
|
|
44
43
|
return e >>> 0;
|
|
45
|
-
},
|
|
46
|
-
Math.floor((t.length - n + 1) * Math.random())
|
|
47
|
-
n
|
|
48
|
-
|
|
44
|
+
}, lt = (t) => t != null && t.length > 0, gt = (t) => E(t).split("_").join(" "), ft = (t) => t.length > 0 && !N.test(t), at = (t) => M.test(t), pt = (t) => !T.test(t), ht = (t) => t.toLowerCase() === t, dt = (t) => t.toUpperCase() === t, Ct = (t, n) => t != null && t !== "" ? t : n, bt = (t) => U.test(t), At = (t) => t == null || t === "", St = (t) => t.substring(0, 1).toLowerCase() + t.substring(1), L = (t, n = 1) => {
|
|
45
|
+
const e = Math.floor((t.length - n + 1) * Math.random());
|
|
46
|
+
return t.substring(e, e + n);
|
|
47
|
+
}, m = (t, n) => Array.from({ length: n }, () => L(t)).join(""), Lt = (t) => m(j, t), mt = (t, n) => Array.from(n).map(t), wt = (t, n) => t.split(n).join(""), It = (t, n) => t.endsWith(n) ? t.substring(0, t.length - n.length) : t, yt = (t, n, e) => t.substring(0, n) + t.substring(n + e), xt = (t, n) => t.startsWith(n) ? t.substring(n.length) : t, Ot = (t, n) => {
|
|
49
48
|
const e = t.indexOf(n);
|
|
50
49
|
return e < 0 ? t : t.substring(0, e) + t.substring(e + n.length);
|
|
51
|
-
},
|
|
52
|
-
const n =
|
|
50
|
+
}, Wt = (t) => {
|
|
51
|
+
const n = Array.from(t);
|
|
53
52
|
return n.reverse(), n.join("");
|
|
54
|
-
},
|
|
55
|
-
`) >= 0 ?
|
|
53
|
+
}, w = (t, n = "'") => n === "'" ? t.includes("'") ? t.includes('"') ? "'" + t.split("'").join("\\'") + "'" : '"' + t + '"' : "'" + t + "'" : t.includes('"') ? t.includes("'") ? '"' + t.split('"').join('\\"') + '"' : "'" + t + "'" : '"' + t + '"', I = (t, n = "'") => n + t.split(n).join("\\" + n) + n, Et = (t, n = "'") => t.indexOf(`
|
|
54
|
+
`) >= 0 ? I(t, "`") : w(t, n), Bt = (t, n) => {
|
|
56
55
|
const e = t.indexOf(n);
|
|
57
56
|
return e < 0 ? [t] : [t.substring(0, e), t.substring(e + n.length)];
|
|
58
|
-
},
|
|
57
|
+
}, y = (t, n) => n.some((e) => t.startsWith(e)), jt = (t, n, e = n) => `${n}${t}${e}`, x = (t) => Array.from({ length: t.length }, (n, e) => t.charCodeAt(e)), zt = (t, n) => {
|
|
59
58
|
const e = [];
|
|
60
59
|
for (; t.length > 0; )
|
|
61
60
|
e.push(t.substring(0, n)), t = t.substring(n, t.length - n);
|
|
62
61
|
return e;
|
|
63
|
-
},
|
|
62
|
+
}, Tt = (t) => t.split(C), Nt = (t, n) => W(O(t, n), n), O = (t, n) => {
|
|
64
63
|
let e = 0;
|
|
65
|
-
for (let r = 0; r < t.length &&
|
|
64
|
+
for (let r = 0; r < t.length && n.includes(t.charAt(r)); r++)
|
|
66
65
|
e++;
|
|
67
66
|
return t.substring(e);
|
|
68
|
-
},
|
|
67
|
+
}, W = (t, n) => {
|
|
69
68
|
const e = t.length;
|
|
70
69
|
let r = e, s;
|
|
71
|
-
for (let c = 0; c < e && (s = e - c - 1,
|
|
70
|
+
for (let c = 0; c < e && (s = e - c - 1, n.includes(t.charAt(s))); c++)
|
|
72
71
|
r = s;
|
|
73
72
|
return t.substring(0, r);
|
|
74
|
-
},
|
|
75
|
-
`) => t.split(
|
|
76
|
-
(s) =>
|
|
77
|
-
).join(r),
|
|
73
|
+
}, E = (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()), _t = (t) => t.substring(0, 1).toUpperCase() + t.substring(1), Mt = (t, n = 78, e = "", r = `
|
|
74
|
+
`) => t.split(C).map(
|
|
75
|
+
(s) => B(s.replace(d, " ").trim(), n, e, r)
|
|
76
|
+
).join(r), a = (t, n) => {
|
|
78
77
|
if (n < 0 || n >= t.length) return !1;
|
|
79
78
|
const e = t.charCodeAt(n);
|
|
80
79
|
return e === 9 || e === 10 || e === 11 || e === 12 || e === 13 || e === 32;
|
|
81
|
-
},
|
|
80
|
+
}, Ut = (t) => {
|
|
82
81
|
if (typeof Buffer < "u")
|
|
83
82
|
return Buffer.from(t).toString("base64");
|
|
84
83
|
if (typeof btoa < "u")
|
|
85
84
|
return btoa(t);
|
|
86
|
-
throw new
|
|
85
|
+
throw new p(
|
|
87
86
|
"No implementation found for base64 encoding"
|
|
88
87
|
);
|
|
89
|
-
},
|
|
88
|
+
}, $t = (t) => {
|
|
90
89
|
if (typeof Buffer < "u")
|
|
91
90
|
return Buffer.from(t, "base64").toString("utf8");
|
|
92
91
|
if (typeof atob < "u")
|
|
93
92
|
return atob(t);
|
|
94
|
-
throw new
|
|
93
|
+
throw new p(
|
|
95
94
|
"No implementation found for base64 decoding"
|
|
96
95
|
);
|
|
97
|
-
},
|
|
98
|
-
const s = [], c = t.length,
|
|
96
|
+
}, B = (t, n, e, r) => {
|
|
97
|
+
const s = [], c = t.length, u = e.length;
|
|
99
98
|
let o = 0;
|
|
100
|
-
for (n -=
|
|
101
|
-
if (o + n >= c -
|
|
99
|
+
for (n -= u; ; ) {
|
|
100
|
+
if (o + n >= c - u) {
|
|
102
101
|
s.push(t.substring(o));
|
|
103
102
|
break;
|
|
104
103
|
}
|
|
105
104
|
let i = 0;
|
|
106
|
-
for (; !
|
|
105
|
+
for (; !a(t, o + n - i) && i < n; ) i++;
|
|
107
106
|
if (i === n) {
|
|
108
|
-
for (i = 0; !
|
|
107
|
+
for (i = 0; !a(t, o + n + i) && o + n + i < c; ) i++;
|
|
109
108
|
s.push(t.substring(o, o + n + i)), o += n + i + 1;
|
|
110
109
|
} else
|
|
111
110
|
s.push(t.substring(o, o + n - i)), o += n - i + 1;
|
|
112
111
|
}
|
|
113
112
|
return e + s.join(r + e);
|
|
114
|
-
},
|
|
113
|
+
}, kt = (t, n, e) => {
|
|
115
114
|
const r = e - t.length;
|
|
116
|
-
return r > 0 ?
|
|
117
|
-
},
|
|
115
|
+
return r > 0 ? n.repeat(r) + t : t;
|
|
116
|
+
}, Ht = (t, n, e) => {
|
|
118
117
|
const r = e - t.length;
|
|
119
|
-
return r > 0 ? t +
|
|
120
|
-
},
|
|
118
|
+
return r > 0 ? t + n.repeat(r) : t;
|
|
119
|
+
}, Zt = (t, n) => {
|
|
121
120
|
const e = t.lastIndexOf(n);
|
|
122
121
|
return e >= 0 ? [t.substring(0, e), t.substring(e + n.length)] : [t];
|
|
123
|
-
},
|
|
122
|
+
}, Dt = (t, n) => {
|
|
124
123
|
const e = t.indexOf(n);
|
|
125
124
|
return e >= 0 ? [t.substring(0, e), t.substring(e + n.length)] : [t];
|
|
126
|
-
},
|
|
125
|
+
}, j = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", z = /[^a-zA-Z]([a-z])/g, T = /[^\t\n\r ]/, N = /[^a-zA-Z]/, _ = /[ \t\r\n][a-z]/g, M = /^[a-z0-9]+$/i, U = /^[0-9]+$/, d = /[ \t\r\n]+/g, C = /\r\n|\n\r|\n|\r/g, $ = /\r\n|\n\r|\r/g;
|
|
127
126
|
export {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
$ as trimCharsRight,
|
|
201
|
-
_t as trimStringSlice,
|
|
202
|
-
k as underscore,
|
|
203
|
-
Gt as upperCaseFirst,
|
|
204
|
-
Qt as wrapColumns,
|
|
205
|
-
H as wrapLine
|
|
127
|
+
G as canonicalizeNewlines,
|
|
128
|
+
g as capitalize,
|
|
129
|
+
F as capitalizeWords,
|
|
130
|
+
zt as chunkString,
|
|
131
|
+
X as collapseText,
|
|
132
|
+
Q as compareCaseInsensitive,
|
|
133
|
+
b as compareStrings,
|
|
134
|
+
et as containsAllText,
|
|
135
|
+
nt as containsAllTextCaseInsensitive,
|
|
136
|
+
tt as containsAnyText,
|
|
137
|
+
v as containsAnyTextCaseInsensitive,
|
|
138
|
+
Y as countStringOccurrences,
|
|
139
|
+
rt as dasherize,
|
|
140
|
+
$t as decodeBase64,
|
|
141
|
+
Ot as deleteFirstFromString,
|
|
142
|
+
It as deleteStringAfter,
|
|
143
|
+
xt as deleteStringBefore,
|
|
144
|
+
wt as deleteSubstring,
|
|
145
|
+
A as ellipsis,
|
|
146
|
+
it as ellipsisMiddle,
|
|
147
|
+
Ut as encodeBase64,
|
|
148
|
+
ct as filterCharcodes,
|
|
149
|
+
ot as filterChars,
|
|
150
|
+
gt as humanize,
|
|
151
|
+
Ct as ifEmptyString,
|
|
152
|
+
ft as isAlpha,
|
|
153
|
+
at as isAlphaNum,
|
|
154
|
+
pt as isBreakingWhitespace,
|
|
155
|
+
bt as isDigitsOnly,
|
|
156
|
+
At as isEmptyString,
|
|
157
|
+
ht as isLowerCase,
|
|
158
|
+
a as isSpaceAt,
|
|
159
|
+
dt as isUpperCase,
|
|
160
|
+
Et as jsQuote,
|
|
161
|
+
St as lowerCaseFirst,
|
|
162
|
+
kt as lpad,
|
|
163
|
+
mt as mapChars,
|
|
164
|
+
I as quote,
|
|
165
|
+
m as randomStringSequence,
|
|
166
|
+
Lt as randomStringSequenceBase64,
|
|
167
|
+
L as randomSubString,
|
|
168
|
+
Wt as reverseString,
|
|
169
|
+
Ht as rpad,
|
|
170
|
+
w as smartQuote,
|
|
171
|
+
Dt as splitStringOnFirst,
|
|
172
|
+
Zt as splitStringOnLast,
|
|
173
|
+
Bt as splitStringOnce,
|
|
174
|
+
S as stringEndsWithAny,
|
|
175
|
+
lt as stringHasContent,
|
|
176
|
+
ut as stringHashCode,
|
|
177
|
+
y as stringStartsWithAny,
|
|
178
|
+
x as stringToCharcodes,
|
|
179
|
+
st as stringsDifferAtIndex,
|
|
180
|
+
Z as substringAfter,
|
|
181
|
+
D as substringAfterLast,
|
|
182
|
+
P as substringBefore,
|
|
183
|
+
R as substringBeforeLast,
|
|
184
|
+
jt as surroundString,
|
|
185
|
+
h as textContainsCaseInsensitive,
|
|
186
|
+
J as textEndsWithAnyCaseInsensitive,
|
|
187
|
+
K as textEndsWithCaseInsensitive,
|
|
188
|
+
V as textStartsWithAnyCaseInsensitive,
|
|
189
|
+
q as textStartsWithCaseInsensitive,
|
|
190
|
+
Tt as textToLines,
|
|
191
|
+
Nt as trimChars,
|
|
192
|
+
O as trimCharsLeft,
|
|
193
|
+
W as trimCharsRight,
|
|
194
|
+
yt as trimStringSlice,
|
|
195
|
+
E as underscore,
|
|
196
|
+
_t as upperCaseFirst,
|
|
197
|
+
Mt as wrapColumns,
|
|
198
|
+
B as wrapLine
|
|
206
199
|
};
|
package/url.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=t=>{try{return new URL(t)}catch{return null}},u=(t,e)=>{if(!e||Object.keys(e).length===0)return t;const n=new URL(t);for(const[r,s]of Object.entries(e))n.searchParams.set(r,s);return n.toString()},g=t=>{try{const e=new URL(t),n={};for(const[r,s]of e.searchParams)n[r]=s;return n}catch{return{}}},h=(t,e,n)=>{try{const r=new URL(t);return r.searchParams.set(e,n),r.toString()}catch{return t}},f=(t,e)=>{try{const n=new URL(t);return n.searchParams.delete(e),n.toString()}catch{return t}},m=t=>{try{return new URL(t),!0}catch{return!1}},P=(...t)=>{if(t.length===0)return"";const e=t.filter(a=>a.length>0);if(e.length===0)return"";const n=e[0].startsWith("/"),r=e[e.length-1].endsWith("/"),o=e.map(a=>a.replace(/^\/+|\/+$/g,"")).filter(a=>a.length>0).join("/");return(n?"/":"")+o+(r?"/":"")},y=t=>{if(!t)return"";const e=t.startsWith("/"),n=t.split("/").filter(o=>o.length>0),r=[];for(const o of n)o!=="."&&(o===".."?r.length>0&&r[r.length-1]!==".."?r.pop():e||r.push(".."):r.push(o));const s=r.join("/");return e?"/"+s:s},c=t=>{const e=l(t),n=e.lastIndexOf(".");return n===-1||n===0?"":e.substring(n)},l=t=>{if(!t||t.match(/\/+$/))return"";const e=t.lastIndexOf("/");return e===-1?t:t.substring(e+1)},d=t=>{const e=l(t),n=c(t);return n?e.substring(0,e.length-n.length):e};exports.buildUrl=u;exports.getBaseName=d;exports.getFileExtension=c;exports.getFileName=l;exports.getQueryParams=g;exports.isValidUrl=m;exports.joinPaths=P;exports.normalizePath=y;exports.parseUrl=i;exports.removeQueryParam=f;exports.setQueryParam=h;
|