@tolki/str 1.0.1 → 1.0.2
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/dist/ascii/index.d.ts +2 -0
- package/dist/ascii/index.d.ts.map +1 -1
- package/dist/base64/index.d.ts +2 -0
- package/dist/base64/index.d.ts.map +1 -1
- package/dist/convertcase/index.d.ts +2 -8
- package/dist/convertcase/index.d.ts.map +1 -1
- package/dist/pluralizer/index.d.ts +8 -14
- package/dist/pluralizer/index.d.ts.map +1 -1
- package/dist/replacer/index.d.ts +6 -0
- package/dist/replacer/index.d.ts.map +1 -1
- package/dist/str.d.ts +46 -136
- package/dist/str.d.ts.map +1 -1
- package/dist/str.js +161 -161
- package/dist/stringable/index.d.ts +4 -8
- package/dist/stringable/index.d.ts.map +1 -1
- package/dist/stringable/index.js +2 -2
- package/dist/transliterate/index.d.ts +1 -3
- package/dist/transliterate/index.d.ts.map +1 -1
- package/dist/trimmer/index.d.ts +6 -0
- package/dist/trimmer/index.d.ts.map +1 -1
- package/dist/ulid/index.d.ts +7 -13
- package/dist/ulid/index.d.ts.map +1 -1
- package/dist/uuid/index.d.ts +8 -16
- package/dist/uuid/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/str.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { substr as x, ltrim as q, rtrim as G, randomInt as
|
|
2
|
-
import { isArray as S, toLower as
|
|
1
|
+
import { substr as x, ltrim as q, rtrim as G, randomInt as O, randomString as K, title as P, trim as Z, upper as D } from "@tolki/str";
|
|
2
|
+
import { isArray as S, toLower as N, isString as _, isFunction as Q, isNumber as V } from "@tolki/utils";
|
|
3
3
|
const R = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map();
|
|
4
4
|
let b = null;
|
|
5
5
|
function T(t, e) {
|
|
@@ -8,41 +8,41 @@ function T(t, e) {
|
|
|
8
8
|
const n = String(e), r = t.indexOf(n);
|
|
9
9
|
return r === -1 ? t : t.slice(r + n.length);
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function at(t, e) {
|
|
12
12
|
if (e === "")
|
|
13
13
|
return t;
|
|
14
14
|
const n = t.lastIndexOf(String(e));
|
|
15
15
|
return n === -1 ? t : t.slice(n + String(e).length);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function X(t, e) {
|
|
18
18
|
if (e === "")
|
|
19
19
|
return t;
|
|
20
20
|
const n = t.indexOf(String(e));
|
|
21
21
|
return n === -1 ? t : t.slice(0, n);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function Y(t, e) {
|
|
24
24
|
if (e === "")
|
|
25
25
|
return t;
|
|
26
26
|
const n = t.lastIndexOf(String(e));
|
|
27
27
|
return n === -1 ? t : x(t, 0, n);
|
|
28
28
|
}
|
|
29
|
-
function at(t, e, n) {
|
|
30
|
-
return e === "" || n === "" ? t : X(T(t, e), n);
|
|
31
|
-
}
|
|
32
29
|
function ut(t, e, n) {
|
|
33
|
-
return e === "" || n === "" ? t :
|
|
30
|
+
return e === "" || n === "" ? t : Y(T(t, e), n);
|
|
31
|
+
}
|
|
32
|
+
function pt(t, e, n) {
|
|
33
|
+
return e === "" || n === "" ? t : X(T(t, e), n);
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function gt(t) {
|
|
36
36
|
if (E.has(t))
|
|
37
37
|
return E.get(t);
|
|
38
|
-
const e =
|
|
38
|
+
const e = st(H(t));
|
|
39
39
|
return E.set(t, e), e;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function mt(t, e) {
|
|
42
42
|
const n = t.length;
|
|
43
43
|
return (e < 0 ? e < -n : e > n - 1) ? !1 : (e < 0 && (e += n), t.charAt(e));
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function ht(t, e) {
|
|
46
46
|
for (const n of S(e) ? e : [e])
|
|
47
47
|
if (n !== "" && t.startsWith(n)) {
|
|
48
48
|
const r = [...t], o = [...n];
|
|
@@ -50,7 +50,7 @@ function mt(t, e) {
|
|
|
50
50
|
}
|
|
51
51
|
return t;
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function dt(t, e) {
|
|
54
54
|
for (const n of S(e) ? e : [e])
|
|
55
55
|
if (n !== "" && t.endsWith(n)) {
|
|
56
56
|
const r = [...t], o = [...n];
|
|
@@ -67,7 +67,7 @@ function B(t, e, n = !1) {
|
|
|
67
67
|
return !0;
|
|
68
68
|
return !1;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function yt(t, e = "", n = {}) {
|
|
71
71
|
const { radius: r = 100, omission: o = "..." } = n, s = String(t ?? ""), c = e ?? "", i = (y) => y.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), l = new RegExp(`^(.*?)(${i(c)})(.*)$`, "iu").exec(s);
|
|
72
72
|
if (!l)
|
|
73
73
|
return null;
|
|
@@ -80,16 +80,16 @@ function dt(t, e = "", n = {}) {
|
|
|
80
80
|
const d = l[2] ?? "";
|
|
81
81
|
return a + d + w;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function wt(t, e, n = !1) {
|
|
84
84
|
for (const r of e)
|
|
85
85
|
if (!B(t, r, n))
|
|
86
86
|
return !1;
|
|
87
87
|
return !0;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function xt(t, e, n = !1) {
|
|
90
90
|
return !B(t, e, n);
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function St(t, e = " ") {
|
|
93
93
|
return S(e) ? (e.forEach((n) => {
|
|
94
94
|
t = t.replace(new RegExp(`${n}+`, "g"), n);
|
|
95
95
|
}), t) : t.replace(new RegExp(`${e}+`, "g"), e);
|
|
@@ -103,25 +103,25 @@ function W(t, e) {
|
|
|
103
103
|
return !0;
|
|
104
104
|
return !1;
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function $t(t, e) {
|
|
107
107
|
return !W(t, e);
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function kt(t, e) {
|
|
110
110
|
const n = e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
111
111
|
return t.replace(new RegExp(`(?:${n})+$`, "u"), "") + e;
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function At(t, e, n = null) {
|
|
114
114
|
return e + t + (n ?? e);
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function bt(t, e, n = null) {
|
|
117
117
|
return U(t, e) && (t = x(t, F(e))), W(t, n ??= e) && (t = x(t, 0, -F(n))), t;
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function Lt(t, e, n = !1) {
|
|
120
120
|
e = String(e);
|
|
121
121
|
let r;
|
|
122
122
|
typeof t == "string" ? r = [t] : r = Array.from(t);
|
|
123
123
|
for (let o of r) {
|
|
124
|
-
if (o = String(o), o === e || n &&
|
|
124
|
+
if (o = String(o), o === e || n && N(o) === N(e))
|
|
125
125
|
return !0;
|
|
126
126
|
o = o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), o = o.replace(/\\\*/g, ".*");
|
|
127
127
|
const s = n ? "iu" : "u";
|
|
@@ -130,14 +130,14 @@ function bt(t, e, n = !1) {
|
|
|
130
130
|
}
|
|
131
131
|
return !1;
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function Rt(t) {
|
|
134
134
|
for (let e = 0; e < t.length; e++)
|
|
135
135
|
if (t.charCodeAt(e) > 127)
|
|
136
136
|
return !1;
|
|
137
137
|
return !0;
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
if (!
|
|
139
|
+
function Et(t) {
|
|
140
|
+
if (!_(t))
|
|
141
141
|
return !1;
|
|
142
142
|
try {
|
|
143
143
|
JSON.parse(t);
|
|
@@ -146,8 +146,8 @@ function Rt(t) {
|
|
|
146
146
|
}
|
|
147
147
|
return !0;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
if (!
|
|
149
|
+
function Ct(t, e = []) {
|
|
150
|
+
if (!_(t))
|
|
151
151
|
return !1;
|
|
152
152
|
const r = (e.length === 0 ? "aaa|aaas|about|acap|acct|acd|acr|adiumxtra|adt|afp|afs|aim|amss|android|appdata|apt|ark|attachment|aw|barion|beshare|bitcoin|bitcoincash|blob|bolo|browserext|calculator|callto|cap|cast|casts|chrome|chrome-extension|cid|coap|coap+tcp|coap+ws|coaps|coaps+tcp|coaps+ws|com-eventbrite-attendee|content|conti|crid|cvs|dab|data|dav|diaspora|dict|did|dis|dlna-playcontainer|dlna-playsingle|dns|dntp|dpp|drm|drop|dtn|dvb|ed2k|elsi|example|facetime|fax|feed|feedready|file|filesystem|finger|first-run-pen-experience|fish|fm|ftp|fuchsia-pkg|geo|gg|git|gizmoproject|go|gopher|graph|gtalk|h323|ham|hcap|hcp|http|https|hxxp|hxxps|hydrazone|iax|icap|icon|im|imap|info|iotdisco|ipn|ipp|ipps|irc|irc6|ircs|iris|iris.beep|iris.lwz|iris.xpc|iris.xpcs|isostore|itms|jabber|jar|jms|keyparc|lastfm|ldap|ldaps|leaptofrogans|lorawan|lvlt|magnet|mailserver|mailto|maps|market|message|mid|mms|modem|mongodb|moz|ms-access|ms-browser-extension|ms-calculator|ms-drive-to|ms-enrollment|ms-excel|ms-eyecontrolspeech|ms-gamebarservices|ms-gamingoverlay|ms-getoffice|ms-help|ms-infopath|ms-inputapp|ms-lockscreencomponent-config|ms-media-stream-id|ms-mixedrealitycapture|ms-mobileplans|ms-officeapp|ms-people|ms-project|ms-powerpoint|ms-publisher|ms-restoretabcompanion|ms-screenclip|ms-screensketch|ms-search|ms-search-repair|ms-secondary-screen-controller|ms-secondary-screen-setup|ms-settings|ms-settings-airplanemode|ms-settings-bluetooth|ms-settings-camera|ms-settings-cellular|ms-settings-cloudstorage|ms-settings-connectabledevices|ms-settings-displays-topology|ms-settings-emailandaccounts|ms-settings-language|ms-settings-location|ms-settings-lock|ms-settings-nfctransactions|ms-settings-notifications|ms-settings-power|ms-settings-privacy|ms-settings-proximity|ms-settings-screenrotation|ms-settings-wifi|ms-settings-workplace|ms-spd|ms-sttoverlay|ms-transit-to|ms-useractivityset|ms-virtualtouchpad|ms-visio|ms-walk-to|ms-whiteboard|ms-whiteboard-cmd|ms-word|msnim|msrp|msrps|mss|mtqp|mumble|mupdate|mvn|news|nfs|ni|nih|nntp|notes|ocf|oid|onenote|onenote-cmd|opaquelocktoken|openpgp4fpr|pack|palm|paparazzi|payto|pkcs11|platform|pop|pres|prospero|proxy|pwid|psyc|pttp|qb|query|redis|rediss|reload|res|resource|rmi|rsync|rtmfp|rtmp|rtsp|rtsps|rtspu|s3|secondlife|service|session|sftp|sgn|shttp|sieve|simpleledger|sip|sips|skype|smb|sms|smtp|snews|snmp|soap.beep|soap.beeps|soldat|spiffe|spotify|ssh|steam|stun|stuns|submit|svn|tag|teamspeak|tel|teliaeid|telnet|tftp|tg|things|thismessage|tip|tn3270|tool|ts3server|turn|turns|tv|udp|unreal|urn|ut2004|v-event|vemmi|ventrilo|videotex|vnc|view-source|wais|webcal|wpid|ws|wss|wtai|wyciwyg|xcon|xcon-userid|xfire|xmlrpc.beep|xmlrpc.beeps|xmpp|xri|ymsgr|z39.50|z39.50r|z39.50s" : e.join("|")).split("|").map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
153
153
|
try {
|
|
@@ -180,31 +180,31 @@ function Et(t, e = []) {
|
|
|
180
180
|
return !1;
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
return
|
|
183
|
+
function Ft(t) {
|
|
184
|
+
return rt(t, "-");
|
|
185
185
|
}
|
|
186
186
|
function F(t) {
|
|
187
187
|
return t.length;
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function zt(t, e = 100, n = "...", r = !1) {
|
|
190
190
|
if (t.length <= e)
|
|
191
191
|
return t;
|
|
192
192
|
if (!r)
|
|
193
193
|
return t.slice(0, e).replace(/\s+$/, "") + n;
|
|
194
|
-
t =
|
|
194
|
+
t = nt(t).replace(/[\n\r]+/g, " ").trim();
|
|
195
195
|
const o = t.slice(0, e).replace(/\s+$/, "");
|
|
196
196
|
return t.substring(e, e + 1) === " " ? o + n : o.replace(/(.*)\s.*/, "$1") + n;
|
|
197
197
|
}
|
|
198
198
|
function J(t) {
|
|
199
|
-
return
|
|
199
|
+
return N(t);
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function _t(t, e = 100, n = "...") {
|
|
202
202
|
if (e <= 0)
|
|
203
203
|
return t;
|
|
204
204
|
const r = e, o = new RegExp(`^\\s*(?:\\S+\\s*){1,${r}}`, "u"), s = t.match(o);
|
|
205
205
|
return !s || F(t) === F(s[0]) ? t : s[0].replace(/\s+$/, "") + n;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function Mt(t, e, n, r = null) {
|
|
208
208
|
if (e === "")
|
|
209
209
|
return t;
|
|
210
210
|
const o = t.length;
|
|
@@ -219,7 +219,7 @@ function _t(t, e, n, r = null) {
|
|
|
219
219
|
const i = t.slice(0, s), f = c.length, l = t.slice(s + f);
|
|
220
220
|
return i + e.slice(0, 1).repeat(f) + l;
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function Ot(t, e) {
|
|
223
223
|
let n = "u", r = t;
|
|
224
224
|
if (t.length >= 2 && t[0] === "/") {
|
|
225
225
|
let o = -1;
|
|
@@ -248,7 +248,7 @@ function Mt(t, e) {
|
|
|
248
248
|
return "";
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function Nt(t, e) {
|
|
252
252
|
e = String(e);
|
|
253
253
|
const n = typeof t == "string" ? [t] : Array.from(t);
|
|
254
254
|
for (const r of n) {
|
|
@@ -282,7 +282,7 @@ function Ot(t, e) {
|
|
|
282
282
|
}
|
|
283
283
|
return !1;
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function Wt(t, e) {
|
|
286
286
|
let n = "u", r = t;
|
|
287
287
|
if (t.length >= 2 && t[0] === "/") {
|
|
288
288
|
let s = -1;
|
|
@@ -316,24 +316,24 @@ function Nt(t, e) {
|
|
|
316
316
|
}
|
|
317
317
|
return o;
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function Ut(t) {
|
|
320
320
|
return S(t) ? t.map((e) => e.replace(/[^0-9]/g, "")) : t.replace(/[^0-9]/g, "");
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function It(t, e, n = " ") {
|
|
323
323
|
const r = t.length;
|
|
324
324
|
if (e <= r || n === "")
|
|
325
325
|
return t;
|
|
326
326
|
const o = e - r, s = Math.floor(o / 2), c = o - s;
|
|
327
327
|
return z(n, s) + t + z(n, c);
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function qt(t, e, n = " ") {
|
|
330
330
|
const r = t.length;
|
|
331
331
|
if (e <= r || n === "")
|
|
332
332
|
return t;
|
|
333
333
|
const s = e - r;
|
|
334
334
|
return z(n, s) + t;
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function Gt(t, e, n = " ") {
|
|
337
337
|
const r = t.length;
|
|
338
338
|
if (e <= r || n === "")
|
|
339
339
|
return t;
|
|
@@ -345,7 +345,7 @@ function z(t, e) {
|
|
|
345
345
|
const n = Math.ceil(e / t.length);
|
|
346
346
|
return t.repeat(n).slice(0, e);
|
|
347
347
|
}
|
|
348
|
-
function
|
|
348
|
+
function Pt(t = 32, e = !0, n = !0, r = !0, o = !1) {
|
|
349
349
|
const l = [
|
|
350
350
|
e ? [
|
|
351
351
|
"a",
|
|
@@ -436,21 +436,21 @@ function Gt(t = 32, e = !0, n = !0, r = !0, o = !1) {
|
|
|
436
436
|
return "";
|
|
437
437
|
const g = [];
|
|
438
438
|
for (const a of l) {
|
|
439
|
-
const p =
|
|
439
|
+
const p = O(0, a.length - 1);
|
|
440
440
|
g.push(a[p]);
|
|
441
441
|
}
|
|
442
442
|
const u = Math.max(0, t - g.length), m = l.flat();
|
|
443
443
|
for (let a = 0; a < u; a++) {
|
|
444
|
-
const p =
|
|
444
|
+
const p = O(0, m.length - 1);
|
|
445
445
|
g.push(m[p]);
|
|
446
446
|
}
|
|
447
447
|
for (let a = g.length - 1; a > 0; a--) {
|
|
448
|
-
const p =
|
|
448
|
+
const p = O(0, a), h = g[a];
|
|
449
449
|
g[a] = g[p], g[p] = h;
|
|
450
450
|
}
|
|
451
451
|
return g.join("");
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function Tt(t, e, n = 0) {
|
|
454
454
|
if (e === "")
|
|
455
455
|
return !1;
|
|
456
456
|
const r = Array.from(t), o = Array.from(e);
|
|
@@ -470,29 +470,29 @@ function Pt(t, e, n = 0) {
|
|
|
470
470
|
}
|
|
471
471
|
return !1;
|
|
472
472
|
}
|
|
473
|
-
function
|
|
473
|
+
function j(t = 16) {
|
|
474
474
|
return (b ?? ((n) => K(n)))(t);
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function v(t) {
|
|
477
477
|
b = t;
|
|
478
478
|
}
|
|
479
|
-
function
|
|
479
|
+
function Bt(t, e) {
|
|
480
480
|
let n = 0;
|
|
481
481
|
const r = e ?? function(o) {
|
|
482
482
|
const s = b;
|
|
483
483
|
b = null;
|
|
484
|
-
const c =
|
|
484
|
+
const c = j(o);
|
|
485
485
|
return b = s, n++, c;
|
|
486
486
|
};
|
|
487
|
-
|
|
487
|
+
v((o) => n < t.length ? String(t[n++]) : r(o));
|
|
488
488
|
}
|
|
489
|
-
function
|
|
489
|
+
function Jt() {
|
|
490
490
|
b = null;
|
|
491
491
|
}
|
|
492
|
-
function
|
|
492
|
+
function Ht(t, e) {
|
|
493
493
|
return e <= 0 ? "" : t.repeat(e);
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function Kt(t, e, n) {
|
|
496
496
|
let r;
|
|
497
497
|
typeof e == "object" && !S(e) ? r = Object.values(e) : r = S(e) ? [...e] : Array.from(e);
|
|
498
498
|
const o = n.split(t);
|
|
@@ -505,7 +505,7 @@ function Ht(t, e, n) {
|
|
|
505
505
|
}
|
|
506
506
|
return String(s);
|
|
507
507
|
}
|
|
508
|
-
function
|
|
508
|
+
function Zt(t, e) {
|
|
509
509
|
try {
|
|
510
510
|
const n = String(t);
|
|
511
511
|
if (n.length)
|
|
@@ -515,7 +515,7 @@ function Kt(t, e) {
|
|
|
515
515
|
return e;
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
|
-
function
|
|
518
|
+
function Dt(t, e, n, r = !0) {
|
|
519
519
|
const o = (l) => typeof l == "string" ? [l] : Array.from(l), s = o(t), c = o(e), i = (l) => l.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = (l) => s.reduce((g, u, m) => {
|
|
520
520
|
if (u === "") return g;
|
|
521
521
|
const a = c[m] ?? "";
|
|
@@ -524,27 +524,27 @@ function Zt(t, e, n, r = !0) {
|
|
|
524
524
|
const p = new RegExp(i(u), "gi");
|
|
525
525
|
return g.replace(p, () => a);
|
|
526
526
|
}, l);
|
|
527
|
-
return
|
|
527
|
+
return _(n) ? f(n) : Array.from(n).map(f);
|
|
528
528
|
}
|
|
529
|
-
function
|
|
529
|
+
function tt(t, e, n) {
|
|
530
530
|
if (t = String(t), t === "")
|
|
531
531
|
return n;
|
|
532
532
|
const r = n.indexOf(t);
|
|
533
533
|
return r !== -1 ? n.slice(0, r) + e + n.slice(r + t.length) : n;
|
|
534
534
|
}
|
|
535
|
-
function
|
|
536
|
-
return t = String(t), t === "" ? n : U(n, t) ?
|
|
535
|
+
function Qt(t, e, n) {
|
|
536
|
+
return t = String(t), t === "" ? n : U(n, t) ? tt(t, e, n) : n;
|
|
537
537
|
}
|
|
538
|
-
function
|
|
538
|
+
function et(t, e, n) {
|
|
539
539
|
if (t = String(t), t === "")
|
|
540
540
|
return n;
|
|
541
541
|
const r = n.lastIndexOf(t);
|
|
542
542
|
return r !== -1 ? n.slice(0, r) + e + n.slice(r + t.length) : n;
|
|
543
543
|
}
|
|
544
|
-
function
|
|
545
|
-
return t = String(t), t === "" ? n : W(n, t) ?
|
|
544
|
+
function Vt(t, e, n) {
|
|
545
|
+
return t = String(t), t === "" ? n : W(n, t) ? et(t, e, n) : n;
|
|
546
546
|
}
|
|
547
|
-
function
|
|
547
|
+
function Xt(t, e, n, r = -1) {
|
|
548
548
|
const o = (u) => S(u) ? u : [u], s = o(t);
|
|
549
549
|
function c(u) {
|
|
550
550
|
try {
|
|
@@ -611,7 +611,7 @@ function Vt(t, e, n, r = -1) {
|
|
|
611
611
|
const h = l[a] ?? (l.length === 1 ? l[0] : "");
|
|
612
612
|
if (r < 0)
|
|
613
613
|
m = m.replace(p, (w, ...d) => {
|
|
614
|
-
const
|
|
614
|
+
const M = typeof d[d.length - 1] == "object" && typeof d[d.length - 2] == "number" ? d.length - 3 : d.length - 2, L = d.slice(0, M).map(($) => String($));
|
|
615
615
|
return h.replace(/\$(\d{1,2})/g, ($, A) => {
|
|
616
616
|
const k = parseInt(A, 10);
|
|
617
617
|
return (L[k - 1] ?? "").toUpperCase();
|
|
@@ -635,10 +635,10 @@ function Vt(t, e, n, r = -1) {
|
|
|
635
635
|
};
|
|
636
636
|
return S(n) ? n.map(g) : g(n);
|
|
637
637
|
}
|
|
638
|
-
function
|
|
638
|
+
function nt(t) {
|
|
639
639
|
return t.replace(/<\/?[^>]+(>|$)/g, "");
|
|
640
640
|
}
|
|
641
|
-
function
|
|
641
|
+
function Yt(t, e, n = !0) {
|
|
642
642
|
const r = typeof t == "string" ? [t] : Array.from(t), o = (c) => c.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), s = (c) => {
|
|
643
643
|
let i = c;
|
|
644
644
|
for (const f of r)
|
|
@@ -653,21 +653,21 @@ function Xt(t, e, n = !0) {
|
|
|
653
653
|
};
|
|
654
654
|
return typeof e == "string" ? s(e) : Array.from(e, (c) => s(String(c)));
|
|
655
655
|
}
|
|
656
|
-
function
|
|
656
|
+
function jt(t) {
|
|
657
657
|
return Array.from(t).reverse().join("");
|
|
658
658
|
}
|
|
659
|
-
function
|
|
659
|
+
function vt(t, e) {
|
|
660
660
|
const n = e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
661
661
|
return e + t.replace(new RegExp(`^(?:${n})+`, "u"), "");
|
|
662
662
|
}
|
|
663
|
-
function
|
|
663
|
+
function te(t) {
|
|
664
664
|
const e = String(t).trim();
|
|
665
665
|
if (e === "")
|
|
666
666
|
return "";
|
|
667
667
|
let n = e.split(/\s+/u);
|
|
668
|
-
return n.length > 1 ? n = n.map((o) => P(o)) : n =
|
|
668
|
+
return n.length > 1 ? n = n.map((o) => P(o)) : n = ot(n.join("_")).map((o) => P(o)), n.join("_").replace(/[-_ ]+/gu, "_").split("_").filter((o) => o.length > 0).join(" ");
|
|
669
669
|
}
|
|
670
|
-
function
|
|
670
|
+
function ee(t) {
|
|
671
671
|
if (t.trim() === "")
|
|
672
672
|
return t;
|
|
673
673
|
const e = /* @__PURE__ */ new Set([
|
|
@@ -723,14 +723,14 @@ function te(t) {
|
|
|
723
723
|
}
|
|
724
724
|
return r.join(" ");
|
|
725
725
|
}
|
|
726
|
-
function
|
|
726
|
+
function rt(t, e = "_") {
|
|
727
727
|
const r = `${t}|${e}`;
|
|
728
728
|
if (R.has(r))
|
|
729
729
|
return R.get(r);
|
|
730
730
|
let o = t;
|
|
731
|
-
return /^[a-z]+$/.test(t) || (o =
|
|
731
|
+
return /^[a-z]+$/.test(t) || (o = it(t).replace(/\s+/gu, ""), o = o.replace(/(.)(?=[A-Z])/g, `$1${e}`), o = J(o)), R.set(r, o), o;
|
|
732
732
|
}
|
|
733
|
-
function
|
|
733
|
+
function ne(t) {
|
|
734
734
|
return Z(t).replace(/[\s\u3164\u1160]+/gu, " ");
|
|
735
735
|
}
|
|
736
736
|
function U(t, e) {
|
|
@@ -739,7 +739,7 @@ function U(t, e) {
|
|
|
739
739
|
let n = [
|
|
740
740
|
e
|
|
741
741
|
];
|
|
742
|
-
|
|
742
|
+
_(e) || V(e) ? n = [e] : Symbol.iterator in Object(e) && (n = Array.from(e));
|
|
743
743
|
const r = String(t);
|
|
744
744
|
for (const o of n) {
|
|
745
745
|
if (o == null)
|
|
@@ -750,7 +750,7 @@ function U(t, e) {
|
|
|
750
750
|
}
|
|
751
751
|
return !1;
|
|
752
752
|
}
|
|
753
|
-
function
|
|
753
|
+
function re(t, e) {
|
|
754
754
|
return !U(t, e);
|
|
755
755
|
}
|
|
756
756
|
function H(t) {
|
|
@@ -764,10 +764,10 @@ function H(t) {
|
|
|
764
764
|
}, s = r.map(o).join("");
|
|
765
765
|
return C.set(e, s), s;
|
|
766
766
|
}
|
|
767
|
-
function
|
|
767
|
+
function se(t) {
|
|
768
768
|
return H(t);
|
|
769
769
|
}
|
|
770
|
-
function
|
|
770
|
+
function oe(t, e) {
|
|
771
771
|
if (!t || Object.keys(t).length === 0)
|
|
772
772
|
return e;
|
|
773
773
|
const n = Object.keys(t).filter((s) => s !== "");
|
|
@@ -777,28 +777,28 @@ function se(t, e) {
|
|
|
777
777
|
const r = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), o = new RegExp(n.map(r).join("|"), "gu");
|
|
778
778
|
return e.replace(o, (s) => t[s] ?? s);
|
|
779
779
|
}
|
|
780
|
-
function
|
|
780
|
+
function ie(t, e) {
|
|
781
781
|
return e < 0 ? x(t, e) : x(t, 0, e);
|
|
782
782
|
}
|
|
783
|
-
function
|
|
783
|
+
function st(t) {
|
|
784
784
|
return J(x(t, 0, 1)) + x(t, 1);
|
|
785
785
|
}
|
|
786
|
-
function
|
|
786
|
+
function ce(t) {
|
|
787
787
|
return D(x(t, 0, 1)) + x(t, 1);
|
|
788
788
|
}
|
|
789
|
-
function
|
|
789
|
+
function ot(t) {
|
|
790
790
|
return t.split(new RegExp("(?=\\p{Lu})", "u")).filter(Boolean);
|
|
791
791
|
}
|
|
792
|
-
function
|
|
792
|
+
function it(t, e = ` \r
|
|
793
793
|
\f\v`) {
|
|
794
794
|
const n = S(e) ? e.join("") : e, r = (i) => i.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"), o = n.length ? r(n) : "", s = o.length ? `(?:\\s|[${o}])` : "\\s", c = new RegExp(`(^|${s})(\\p{Ll})`, "gu");
|
|
795
795
|
return t.replace(c, (i, f, l) => f + l.toUpperCase());
|
|
796
796
|
}
|
|
797
|
-
function
|
|
797
|
+
function le(t, e = null) {
|
|
798
798
|
const n = e && e.length > 0 ? e.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&") : "", r = n.length > 0 ? new RegExp(`[\\p{L}\\p{N}${n}]+`, "gu") : /[\p{L}\p{N}]+/gu, o = t.match(r);
|
|
799
799
|
return o ? o.length : 0;
|
|
800
800
|
}
|
|
801
|
-
function
|
|
801
|
+
function fe(t, e = 75, n = `
|
|
802
802
|
`, r = !1) {
|
|
803
803
|
if (t.length === 0 || e < 1 || n === "")
|
|
804
804
|
return t;
|
|
@@ -847,94 +847,94 @@ function le(t, e = 75, n = `
|
|
|
847
847
|
}
|
|
848
848
|
return s.join(n);
|
|
849
849
|
}
|
|
850
|
-
function
|
|
850
|
+
function ae() {
|
|
851
851
|
return R.size;
|
|
852
852
|
}
|
|
853
|
-
function
|
|
853
|
+
function ue() {
|
|
854
854
|
return E.size;
|
|
855
855
|
}
|
|
856
|
-
function
|
|
856
|
+
function pe() {
|
|
857
857
|
return C.size;
|
|
858
858
|
}
|
|
859
|
-
function
|
|
859
|
+
function ge() {
|
|
860
860
|
R.clear(), E.clear(), C.clear();
|
|
861
861
|
}
|
|
862
862
|
export {
|
|
863
863
|
T as after,
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
864
|
+
at as afterLast,
|
|
865
|
+
ee as apa,
|
|
866
|
+
X as before,
|
|
867
|
+
Y as beforeLast,
|
|
868
|
+
ut as between,
|
|
869
|
+
pt as betweenFirst,
|
|
870
|
+
gt as camel,
|
|
871
|
+
ue as camelCacheSize,
|
|
872
|
+
mt as charAt,
|
|
873
|
+
dt as chopEnd,
|
|
874
|
+
ht as chopStart,
|
|
875
875
|
B as contains,
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
876
|
+
wt as containsAll,
|
|
877
|
+
Jt as createRandomStringsNormally,
|
|
878
|
+
v as createRandomStringsUsing,
|
|
879
|
+
Bt as createRandomStringsUsingSequence,
|
|
880
|
+
St as deduplicate,
|
|
881
|
+
xt as doesntContain,
|
|
882
|
+
$t as doesntEndWith,
|
|
883
|
+
re as doesntStartWith,
|
|
884
884
|
W as endsWith,
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
885
|
+
yt as excerpt,
|
|
886
|
+
kt as finish,
|
|
887
|
+
ge as flushCache,
|
|
888
|
+
te as headline,
|
|
889
|
+
Lt as is,
|
|
890
|
+
Rt as isAscii,
|
|
891
|
+
Et as isJson,
|
|
892
|
+
Nt as isMatch,
|
|
893
|
+
Ct as isUrl,
|
|
894
|
+
Ft as kebab,
|
|
895
|
+
st as lcfirst,
|
|
896
896
|
F as length,
|
|
897
|
-
|
|
897
|
+
zt as limit,
|
|
898
898
|
J as lower,
|
|
899
899
|
z as makePad,
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
900
|
+
Mt as mask,
|
|
901
|
+
Ot as match,
|
|
902
|
+
Wt as matchAll,
|
|
903
|
+
Ut as numbers,
|
|
904
|
+
It as padBoth,
|
|
905
|
+
qt as padLeft,
|
|
906
|
+
Gt as padRight,
|
|
907
|
+
se as pascal,
|
|
908
|
+
Pt as password,
|
|
909
|
+
Tt as position,
|
|
910
|
+
j as random,
|
|
911
|
+
Yt as remove,
|
|
912
|
+
Ht as repeat,
|
|
913
|
+
Dt as replace,
|
|
914
|
+
Kt as replaceArray,
|
|
915
|
+
Vt as replaceEnd,
|
|
916
|
+
tt as replaceFirst,
|
|
917
|
+
et as replaceLast,
|
|
918
|
+
Xt as replaceMatches,
|
|
919
|
+
Qt as replaceStart,
|
|
920
|
+
jt as reverse,
|
|
921
|
+
rt as snake,
|
|
922
|
+
ae as snakeCacheSize,
|
|
923
|
+
ne as squish,
|
|
924
|
+
vt as start,
|
|
925
925
|
U as startsWith,
|
|
926
|
-
|
|
926
|
+
nt as stripTags,
|
|
927
927
|
H as studly,
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
928
|
+
pe as studlyCacheSize,
|
|
929
|
+
oe as swap,
|
|
930
|
+
ie as take,
|
|
931
|
+
Zt as toStringOr,
|
|
932
|
+
ce as ucfirst,
|
|
933
|
+
ot as ucsplit,
|
|
934
|
+
it as ucwords,
|
|
935
|
+
bt as unwrap,
|
|
936
|
+
le as wordCount,
|
|
937
|
+
fe as wordWrap,
|
|
938
|
+
_t as words,
|
|
939
|
+
At as wrap
|
|
940
940
|
};
|