@tolki/str 1.0.0 → 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 +4 -4
- package/dist/ascii/index.d.ts.map +1 -1
- package/dist/base64/index.d.ts +4 -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/markdown/index.d.ts +5 -8
- package/dist/markdown/index.d.ts.map +1 -1
- package/dist/markdown/index.js +21 -20
- 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 +82 -254
- package/dist/str.d.ts.map +1 -1
- package/dist/str.js +164 -163
- 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 +8 -18
- package/dist/ulid/index.d.ts.map +1 -1
- package/dist/uuid/index.d.ts +10 -21
- package/dist/uuid/index.d.ts.map +1 -1
- package/package.json +5 -4
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,8 +67,8 @@ function B(t, e, n = !1) {
|
|
|
67
67
|
return !0;
|
|
68
68
|
return !1;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
const r =
|
|
70
|
+
function yt(t, e = "", n = {}) {
|
|
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;
|
|
74
74
|
const g = q(l[1] ?? ""), u = Array.from(g).length, m = x(g, Math.max(u - r, 0), r);
|
|
@@ -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,13 +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
|
-
if (t.charCodeAt(e) > 127)
|
|
135
|
+
if (t.charCodeAt(e) > 127)
|
|
136
|
+
return !1;
|
|
136
137
|
return !0;
|
|
137
138
|
}
|
|
138
|
-
function
|
|
139
|
-
if (!
|
|
139
|
+
function Et(t) {
|
|
140
|
+
if (!_(t))
|
|
140
141
|
return !1;
|
|
141
142
|
try {
|
|
142
143
|
JSON.parse(t);
|
|
@@ -145,8 +146,8 @@ function Rt(t) {
|
|
|
145
146
|
}
|
|
146
147
|
return !0;
|
|
147
148
|
}
|
|
148
|
-
function
|
|
149
|
-
if (!
|
|
149
|
+
function Ct(t, e = []) {
|
|
150
|
+
if (!_(t))
|
|
150
151
|
return !1;
|
|
151
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("|");
|
|
152
153
|
try {
|
|
@@ -179,31 +180,31 @@ function Et(t, e = []) {
|
|
|
179
180
|
return !1;
|
|
180
181
|
}
|
|
181
182
|
}
|
|
182
|
-
function
|
|
183
|
-
return
|
|
183
|
+
function Ft(t) {
|
|
184
|
+
return rt(t, "-");
|
|
184
185
|
}
|
|
185
186
|
function F(t) {
|
|
186
187
|
return t.length;
|
|
187
188
|
}
|
|
188
|
-
function
|
|
189
|
+
function zt(t, e = 100, n = "...", r = !1) {
|
|
189
190
|
if (t.length <= e)
|
|
190
191
|
return t;
|
|
191
192
|
if (!r)
|
|
192
193
|
return t.slice(0, e).replace(/\s+$/, "") + n;
|
|
193
|
-
t =
|
|
194
|
+
t = nt(t).replace(/[\n\r]+/g, " ").trim();
|
|
194
195
|
const o = t.slice(0, e).replace(/\s+$/, "");
|
|
195
196
|
return t.substring(e, e + 1) === " " ? o + n : o.replace(/(.*)\s.*/, "$1") + n;
|
|
196
197
|
}
|
|
197
198
|
function J(t) {
|
|
198
|
-
return
|
|
199
|
+
return N(t);
|
|
199
200
|
}
|
|
200
|
-
function
|
|
201
|
+
function _t(t, e = 100, n = "...") {
|
|
201
202
|
if (e <= 0)
|
|
202
203
|
return t;
|
|
203
204
|
const r = e, o = new RegExp(`^\\s*(?:\\S+\\s*){1,${r}}`, "u"), s = t.match(o);
|
|
204
205
|
return !s || F(t) === F(s[0]) ? t : s[0].replace(/\s+$/, "") + n;
|
|
205
206
|
}
|
|
206
|
-
function
|
|
207
|
+
function Mt(t, e, n, r = null) {
|
|
207
208
|
if (e === "")
|
|
208
209
|
return t;
|
|
209
210
|
const o = t.length;
|
|
@@ -218,7 +219,7 @@ function _t(t, e, n, r = null) {
|
|
|
218
219
|
const i = t.slice(0, s), f = c.length, l = t.slice(s + f);
|
|
219
220
|
return i + e.slice(0, 1).repeat(f) + l;
|
|
220
221
|
}
|
|
221
|
-
function
|
|
222
|
+
function Ot(t, e) {
|
|
222
223
|
let n = "u", r = t;
|
|
223
224
|
if (t.length >= 2 && t[0] === "/") {
|
|
224
225
|
let o = -1;
|
|
@@ -247,7 +248,7 @@ function Mt(t, e) {
|
|
|
247
248
|
return "";
|
|
248
249
|
}
|
|
249
250
|
}
|
|
250
|
-
function
|
|
251
|
+
function Nt(t, e) {
|
|
251
252
|
e = String(e);
|
|
252
253
|
const n = typeof t == "string" ? [t] : Array.from(t);
|
|
253
254
|
for (const r of n) {
|
|
@@ -281,7 +282,7 @@ function Ot(t, e) {
|
|
|
281
282
|
}
|
|
282
283
|
return !1;
|
|
283
284
|
}
|
|
284
|
-
function
|
|
285
|
+
function Wt(t, e) {
|
|
285
286
|
let n = "u", r = t;
|
|
286
287
|
if (t.length >= 2 && t[0] === "/") {
|
|
287
288
|
let s = -1;
|
|
@@ -315,24 +316,24 @@ function Nt(t, e) {
|
|
|
315
316
|
}
|
|
316
317
|
return o;
|
|
317
318
|
}
|
|
318
|
-
function
|
|
319
|
+
function Ut(t) {
|
|
319
320
|
return S(t) ? t.map((e) => e.replace(/[^0-9]/g, "")) : t.replace(/[^0-9]/g, "");
|
|
320
321
|
}
|
|
321
|
-
function
|
|
322
|
+
function It(t, e, n = " ") {
|
|
322
323
|
const r = t.length;
|
|
323
324
|
if (e <= r || n === "")
|
|
324
325
|
return t;
|
|
325
326
|
const o = e - r, s = Math.floor(o / 2), c = o - s;
|
|
326
327
|
return z(n, s) + t + z(n, c);
|
|
327
328
|
}
|
|
328
|
-
function
|
|
329
|
+
function qt(t, e, n = " ") {
|
|
329
330
|
const r = t.length;
|
|
330
331
|
if (e <= r || n === "")
|
|
331
332
|
return t;
|
|
332
333
|
const s = e - r;
|
|
333
334
|
return z(n, s) + t;
|
|
334
335
|
}
|
|
335
|
-
function
|
|
336
|
+
function Gt(t, e, n = " ") {
|
|
336
337
|
const r = t.length;
|
|
337
338
|
if (e <= r || n === "")
|
|
338
339
|
return t;
|
|
@@ -344,7 +345,7 @@ function z(t, e) {
|
|
|
344
345
|
const n = Math.ceil(e / t.length);
|
|
345
346
|
return t.repeat(n).slice(0, e);
|
|
346
347
|
}
|
|
347
|
-
function
|
|
348
|
+
function Pt(t = 32, e = !0, n = !0, r = !0, o = !1) {
|
|
348
349
|
const l = [
|
|
349
350
|
e ? [
|
|
350
351
|
"a",
|
|
@@ -435,21 +436,21 @@ function Gt(t = 32, e = !0, n = !0, r = !0, o = !1) {
|
|
|
435
436
|
return "";
|
|
436
437
|
const g = [];
|
|
437
438
|
for (const a of l) {
|
|
438
|
-
const p =
|
|
439
|
+
const p = O(0, a.length - 1);
|
|
439
440
|
g.push(a[p]);
|
|
440
441
|
}
|
|
441
442
|
const u = Math.max(0, t - g.length), m = l.flat();
|
|
442
443
|
for (let a = 0; a < u; a++) {
|
|
443
|
-
const p =
|
|
444
|
+
const p = O(0, m.length - 1);
|
|
444
445
|
g.push(m[p]);
|
|
445
446
|
}
|
|
446
447
|
for (let a = g.length - 1; a > 0; a--) {
|
|
447
|
-
const p =
|
|
448
|
+
const p = O(0, a), h = g[a];
|
|
448
449
|
g[a] = g[p], g[p] = h;
|
|
449
450
|
}
|
|
450
451
|
return g.join("");
|
|
451
452
|
}
|
|
452
|
-
function
|
|
453
|
+
function Tt(t, e, n = 0) {
|
|
453
454
|
if (e === "")
|
|
454
455
|
return !1;
|
|
455
456
|
const r = Array.from(t), o = Array.from(e);
|
|
@@ -469,29 +470,29 @@ function Pt(t, e, n = 0) {
|
|
|
469
470
|
}
|
|
470
471
|
return !1;
|
|
471
472
|
}
|
|
472
|
-
function
|
|
473
|
+
function j(t = 16) {
|
|
473
474
|
return (b ?? ((n) => K(n)))(t);
|
|
474
475
|
}
|
|
475
|
-
function
|
|
476
|
+
function v(t) {
|
|
476
477
|
b = t;
|
|
477
478
|
}
|
|
478
|
-
function
|
|
479
|
+
function Bt(t, e) {
|
|
479
480
|
let n = 0;
|
|
480
481
|
const r = e ?? function(o) {
|
|
481
482
|
const s = b;
|
|
482
483
|
b = null;
|
|
483
|
-
const c =
|
|
484
|
+
const c = j(o);
|
|
484
485
|
return b = s, n++, c;
|
|
485
486
|
};
|
|
486
|
-
|
|
487
|
+
v((o) => n < t.length ? String(t[n++]) : r(o));
|
|
487
488
|
}
|
|
488
|
-
function
|
|
489
|
+
function Jt() {
|
|
489
490
|
b = null;
|
|
490
491
|
}
|
|
491
|
-
function
|
|
492
|
+
function Ht(t, e) {
|
|
492
493
|
return e <= 0 ? "" : t.repeat(e);
|
|
493
494
|
}
|
|
494
|
-
function
|
|
495
|
+
function Kt(t, e, n) {
|
|
495
496
|
let r;
|
|
496
497
|
typeof e == "object" && !S(e) ? r = Object.values(e) : r = S(e) ? [...e] : Array.from(e);
|
|
497
498
|
const o = n.split(t);
|
|
@@ -504,7 +505,7 @@ function Ht(t, e, n) {
|
|
|
504
505
|
}
|
|
505
506
|
return String(s);
|
|
506
507
|
}
|
|
507
|
-
function
|
|
508
|
+
function Zt(t, e) {
|
|
508
509
|
try {
|
|
509
510
|
const n = String(t);
|
|
510
511
|
if (n.length)
|
|
@@ -514,7 +515,7 @@ function Kt(t, e) {
|
|
|
514
515
|
return e;
|
|
515
516
|
}
|
|
516
517
|
}
|
|
517
|
-
function
|
|
518
|
+
function Dt(t, e, n, r = !0) {
|
|
518
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) => {
|
|
519
520
|
if (u === "") return g;
|
|
520
521
|
const a = c[m] ?? "";
|
|
@@ -523,27 +524,27 @@ function Zt(t, e, n, r = !0) {
|
|
|
523
524
|
const p = new RegExp(i(u), "gi");
|
|
524
525
|
return g.replace(p, () => a);
|
|
525
526
|
}, l);
|
|
526
|
-
return
|
|
527
|
+
return _(n) ? f(n) : Array.from(n).map(f);
|
|
527
528
|
}
|
|
528
|
-
function
|
|
529
|
+
function tt(t, e, n) {
|
|
529
530
|
if (t = String(t), t === "")
|
|
530
531
|
return n;
|
|
531
532
|
const r = n.indexOf(t);
|
|
532
533
|
return r !== -1 ? n.slice(0, r) + e + n.slice(r + t.length) : n;
|
|
533
534
|
}
|
|
534
|
-
function
|
|
535
|
-
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;
|
|
536
537
|
}
|
|
537
|
-
function
|
|
538
|
+
function et(t, e, n) {
|
|
538
539
|
if (t = String(t), t === "")
|
|
539
540
|
return n;
|
|
540
541
|
const r = n.lastIndexOf(t);
|
|
541
542
|
return r !== -1 ? n.slice(0, r) + e + n.slice(r + t.length) : n;
|
|
542
543
|
}
|
|
543
|
-
function
|
|
544
|
-
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;
|
|
545
546
|
}
|
|
546
|
-
function
|
|
547
|
+
function Xt(t, e, n, r = -1) {
|
|
547
548
|
const o = (u) => S(u) ? u : [u], s = o(t);
|
|
548
549
|
function c(u) {
|
|
549
550
|
try {
|
|
@@ -610,7 +611,7 @@ function Vt(t, e, n, r = -1) {
|
|
|
610
611
|
const h = l[a] ?? (l.length === 1 ? l[0] : "");
|
|
611
612
|
if (r < 0)
|
|
612
613
|
m = m.replace(p, (w, ...d) => {
|
|
613
|
-
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($));
|
|
614
615
|
return h.replace(/\$(\d{1,2})/g, ($, A) => {
|
|
615
616
|
const k = parseInt(A, 10);
|
|
616
617
|
return (L[k - 1] ?? "").toUpperCase();
|
|
@@ -634,10 +635,10 @@ function Vt(t, e, n, r = -1) {
|
|
|
634
635
|
};
|
|
635
636
|
return S(n) ? n.map(g) : g(n);
|
|
636
637
|
}
|
|
637
|
-
function
|
|
638
|
+
function nt(t) {
|
|
638
639
|
return t.replace(/<\/?[^>]+(>|$)/g, "");
|
|
639
640
|
}
|
|
640
|
-
function
|
|
641
|
+
function Yt(t, e, n = !0) {
|
|
641
642
|
const r = typeof t == "string" ? [t] : Array.from(t), o = (c) => c.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), s = (c) => {
|
|
642
643
|
let i = c;
|
|
643
644
|
for (const f of r)
|
|
@@ -652,21 +653,21 @@ function Xt(t, e, n = !0) {
|
|
|
652
653
|
};
|
|
653
654
|
return typeof e == "string" ? s(e) : Array.from(e, (c) => s(String(c)));
|
|
654
655
|
}
|
|
655
|
-
function
|
|
656
|
+
function jt(t) {
|
|
656
657
|
return Array.from(t).reverse().join("");
|
|
657
658
|
}
|
|
658
|
-
function
|
|
659
|
+
function vt(t, e) {
|
|
659
660
|
const n = e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
660
661
|
return e + t.replace(new RegExp(`^(?:${n})+`, "u"), "");
|
|
661
662
|
}
|
|
662
|
-
function
|
|
663
|
+
function te(t) {
|
|
663
664
|
const e = String(t).trim();
|
|
664
665
|
if (e === "")
|
|
665
666
|
return "";
|
|
666
667
|
let n = e.split(/\s+/u);
|
|
667
|
-
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(" ");
|
|
668
669
|
}
|
|
669
|
-
function
|
|
670
|
+
function ee(t) {
|
|
670
671
|
if (t.trim() === "")
|
|
671
672
|
return t;
|
|
672
673
|
const e = /* @__PURE__ */ new Set([
|
|
@@ -722,14 +723,14 @@ function te(t) {
|
|
|
722
723
|
}
|
|
723
724
|
return r.join(" ");
|
|
724
725
|
}
|
|
725
|
-
function
|
|
726
|
+
function rt(t, e = "_") {
|
|
726
727
|
const r = `${t}|${e}`;
|
|
727
728
|
if (R.has(r))
|
|
728
729
|
return R.get(r);
|
|
729
730
|
let o = t;
|
|
730
|
-
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;
|
|
731
732
|
}
|
|
732
|
-
function
|
|
733
|
+
function ne(t) {
|
|
733
734
|
return Z(t).replace(/[\s\u3164\u1160]+/gu, " ");
|
|
734
735
|
}
|
|
735
736
|
function U(t, e) {
|
|
@@ -738,7 +739,7 @@ function U(t, e) {
|
|
|
738
739
|
let n = [
|
|
739
740
|
e
|
|
740
741
|
];
|
|
741
|
-
|
|
742
|
+
_(e) || V(e) ? n = [e] : Symbol.iterator in Object(e) && (n = Array.from(e));
|
|
742
743
|
const r = String(t);
|
|
743
744
|
for (const o of n) {
|
|
744
745
|
if (o == null)
|
|
@@ -749,7 +750,7 @@ function U(t, e) {
|
|
|
749
750
|
}
|
|
750
751
|
return !1;
|
|
751
752
|
}
|
|
752
|
-
function
|
|
753
|
+
function re(t, e) {
|
|
753
754
|
return !U(t, e);
|
|
754
755
|
}
|
|
755
756
|
function H(t) {
|
|
@@ -763,10 +764,10 @@ function H(t) {
|
|
|
763
764
|
}, s = r.map(o).join("");
|
|
764
765
|
return C.set(e, s), s;
|
|
765
766
|
}
|
|
766
|
-
function
|
|
767
|
+
function se(t) {
|
|
767
768
|
return H(t);
|
|
768
769
|
}
|
|
769
|
-
function
|
|
770
|
+
function oe(t, e) {
|
|
770
771
|
if (!t || Object.keys(t).length === 0)
|
|
771
772
|
return e;
|
|
772
773
|
const n = Object.keys(t).filter((s) => s !== "");
|
|
@@ -776,28 +777,28 @@ function se(t, e) {
|
|
|
776
777
|
const r = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), o = new RegExp(n.map(r).join("|"), "gu");
|
|
777
778
|
return e.replace(o, (s) => t[s] ?? s);
|
|
778
779
|
}
|
|
779
|
-
function
|
|
780
|
+
function ie(t, e) {
|
|
780
781
|
return e < 0 ? x(t, e) : x(t, 0, e);
|
|
781
782
|
}
|
|
782
|
-
function
|
|
783
|
+
function st(t) {
|
|
783
784
|
return J(x(t, 0, 1)) + x(t, 1);
|
|
784
785
|
}
|
|
785
|
-
function
|
|
786
|
+
function ce(t) {
|
|
786
787
|
return D(x(t, 0, 1)) + x(t, 1);
|
|
787
788
|
}
|
|
788
|
-
function
|
|
789
|
+
function ot(t) {
|
|
789
790
|
return t.split(new RegExp("(?=\\p{Lu})", "u")).filter(Boolean);
|
|
790
791
|
}
|
|
791
|
-
function
|
|
792
|
+
function it(t, e = ` \r
|
|
792
793
|
\f\v`) {
|
|
793
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");
|
|
794
795
|
return t.replace(c, (i, f, l) => f + l.toUpperCase());
|
|
795
796
|
}
|
|
796
|
-
function
|
|
797
|
+
function le(t, e = null) {
|
|
797
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);
|
|
798
799
|
return o ? o.length : 0;
|
|
799
800
|
}
|
|
800
|
-
function
|
|
801
|
+
function fe(t, e = 75, n = `
|
|
801
802
|
`, r = !1) {
|
|
802
803
|
if (t.length === 0 || e < 1 || n === "")
|
|
803
804
|
return t;
|
|
@@ -846,94 +847,94 @@ function le(t, e = 75, n = `
|
|
|
846
847
|
}
|
|
847
848
|
return s.join(n);
|
|
848
849
|
}
|
|
849
|
-
function
|
|
850
|
+
function ae() {
|
|
850
851
|
return R.size;
|
|
851
852
|
}
|
|
852
|
-
function
|
|
853
|
+
function ue() {
|
|
853
854
|
return E.size;
|
|
854
855
|
}
|
|
855
|
-
function
|
|
856
|
+
function pe() {
|
|
856
857
|
return C.size;
|
|
857
858
|
}
|
|
858
|
-
function
|
|
859
|
+
function ge() {
|
|
859
860
|
R.clear(), E.clear(), C.clear();
|
|
860
861
|
}
|
|
861
862
|
export {
|
|
862
863
|
T as after,
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
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,
|
|
874
875
|
B as contains,
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
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,
|
|
883
884
|
W as endsWith,
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
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,
|
|
895
896
|
F as length,
|
|
896
|
-
|
|
897
|
+
zt as limit,
|
|
897
898
|
J as lower,
|
|
898
899
|
z as makePad,
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
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,
|
|
924
925
|
U as startsWith,
|
|
925
|
-
|
|
926
|
+
nt as stripTags,
|
|
926
927
|
H as studly,
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
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
|
|
939
940
|
};
|