@zinaid/str 0.0.6 → 0.0.7
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 +5 -0
- package/dist/ascii/index.d.ts.map +1 -1
- package/dist/base64/index.d.ts +16 -0
- package/dist/base64/index.d.ts.map +1 -1
- package/dist/base64/index.js +52 -51
- package/dist/convertcase/index.d.ts +10 -0
- package/dist/convertcase/index.d.ts.map +1 -1
- package/dist/index.js +106 -105
- package/dist/markdown/index.d.ts +23 -0
- package/dist/markdown/index.d.ts.map +1 -1
- package/dist/pluralizer/index.d.ts +61 -0
- package/dist/pluralizer/index.d.ts.map +1 -1
- package/dist/pluralizer/index.js +36 -27
- package/dist/replacer/index.d.ts +14 -14
- package/dist/str.d.ts +300 -60
- package/dist/str.d.ts.map +1 -1
- package/dist/str.js +182 -198
- package/dist/stringable/index.d.ts +398 -1
- package/dist/stringable/index.d.ts.map +1 -1
- package/dist/stringable/index.js +400 -13
- package/dist/transliterate/index.d.ts +5 -0
- package/dist/transliterate/index.d.ts.map +1 -1
- package/dist/trimmer/index.d.ts +21 -0
- package/dist/trimmer/index.d.ts.map +1 -1
- package/dist/ulid/index.d.ts +38 -0
- package/dist/ulid/index.d.ts.map +1 -1
- package/dist/ulid/index.js +37 -29
- package/dist/uuid/index.d.ts +34 -0
- package/dist/uuid/index.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/str.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { substr as x, ltrim as
|
|
2
|
-
import { isArray as S, toLower as
|
|
1
|
+
import { substr as x, ltrim as G, rtrim as P, randomInt as O, randomString as J, title as j, ascii as Z, trim as H, upper as V } from "@zinaid/str";
|
|
2
|
+
import { isArray as S, toLower as N, isString as M, isFunction as D } from "@zinaid/utils";
|
|
3
3
|
const R = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map();
|
|
4
4
|
let b = null;
|
|
5
5
|
function K(t, e) {
|
|
@@ -8,41 +8,41 @@ function K(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 Q(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 X(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
|
|
30
|
-
return e === "" || n === "" ? t : Y(K(t, e), n);
|
|
31
|
-
}
|
|
32
|
-
function mt(t, e, n) {
|
|
29
|
+
function ut(t, e, n) {
|
|
33
30
|
return e === "" || n === "" ? t : X(K(t, e), n);
|
|
34
31
|
}
|
|
35
|
-
function
|
|
32
|
+
function pt(t, e, n) {
|
|
33
|
+
return e === "" || n === "" ? t : Q(K(t, e), n);
|
|
34
|
+
}
|
|
35
|
+
function gt(t) {
|
|
36
36
|
if (E.has(t))
|
|
37
37
|
return E.get(t);
|
|
38
|
-
const e =
|
|
38
|
+
const e = st(B(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], s = [...n];
|
|
@@ -50,7 +50,7 @@ function yt(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], s = [...n];
|
|
@@ -67,29 +67,29 @@ function T(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 r = n.radius ?? 100, s = n.omission ?? "...", o = String(t ?? ""), c = e ?? "", i = (w) => w.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`^(.*?)(${i(c)})(.*)$`, "iu").exec(o);
|
|
72
72
|
if (!f)
|
|
73
73
|
return null;
|
|
74
|
-
const m =
|
|
75
|
-
let p =
|
|
74
|
+
const m = G(f[1] ?? ""), u = Array.from(m).length, a = x(m, Math.max(u - r, 0), r);
|
|
75
|
+
let p = G(a);
|
|
76
76
|
p !== m && (p = s + p);
|
|
77
|
-
const g =
|
|
78
|
-
let d =
|
|
77
|
+
const g = P(f[3] ?? ""), h = x(g, 0, r);
|
|
78
|
+
let d = P(h);
|
|
79
79
|
d !== g && (d = d + s);
|
|
80
80
|
const y = f[2] ?? "";
|
|
81
81
|
return p + y + d;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function wt(t, e, n = !1) {
|
|
84
84
|
for (const r of e)
|
|
85
85
|
if (!T(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 !T(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 I(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 s of r) {
|
|
124
|
-
if (s = String(s), s === e || n &&
|
|
124
|
+
if (s = String(s), s === e || n && N(s) === N(e))
|
|
125
125
|
return !0;
|
|
126
126
|
s = s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), s = s.replace(/\\\*/g, ".*");
|
|
127
127
|
const o = n ? "iu" : "u";
|
|
@@ -130,13 +130,13 @@ function Et(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) return !1;
|
|
136
136
|
return !0;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
if (!
|
|
138
|
+
function Et(t) {
|
|
139
|
+
if (!M(t))
|
|
140
140
|
return !1;
|
|
141
141
|
try {
|
|
142
142
|
JSON.parse(t);
|
|
@@ -145,8 +145,8 @@ function Ft(t) {
|
|
|
145
145
|
}
|
|
146
146
|
return !0;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
if (!
|
|
148
|
+
function Ct(t, e = []) {
|
|
149
|
+
if (!M(t))
|
|
150
150
|
return !1;
|
|
151
151
|
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((o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
152
152
|
try {
|
|
@@ -179,37 +179,31 @@ function zt(t, e = []) {
|
|
|
179
179
|
return !1;
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
|
|
184
|
-
return !1;
|
|
185
|
-
const e = t.toUpperCase();
|
|
186
|
-
return /^[0-9A-HJKMNP-TV-Z]{26}$/.test(e);
|
|
187
|
-
}
|
|
188
|
-
function Nt(t) {
|
|
189
|
-
return ot(t, "-");
|
|
182
|
+
function Ft(t) {
|
|
183
|
+
return rt(t, "-");
|
|
190
184
|
}
|
|
191
185
|
function F(t) {
|
|
192
186
|
return t.length;
|
|
193
187
|
}
|
|
194
|
-
function
|
|
188
|
+
function zt(t, e = 100, n = "...", r = !1) {
|
|
195
189
|
if (t.length <= e)
|
|
196
190
|
return t;
|
|
197
191
|
if (!r)
|
|
198
192
|
return t.slice(0, e).replace(/\s+$/, "") + n;
|
|
199
|
-
t =
|
|
193
|
+
t = nt(t).replace(/[\n\r]+/g, " ").trim();
|
|
200
194
|
const s = t.slice(0, e).replace(/\s+$/, "");
|
|
201
195
|
return t.substring(e, e + 1) === " " ? s + n : s.replace(/(.*)\s.*/, "$1") + n;
|
|
202
196
|
}
|
|
203
197
|
function U(t) {
|
|
204
|
-
return
|
|
198
|
+
return N(t);
|
|
205
199
|
}
|
|
206
|
-
function
|
|
200
|
+
function _t(t, e = 100, n = "...") {
|
|
207
201
|
if (e <= 0)
|
|
208
202
|
return t;
|
|
209
203
|
const r = e, s = new RegExp(`^\\s*(?:\\S+\\s*){1,${r}}`, "u"), o = t.match(s);
|
|
210
204
|
return !o || F(t) === F(o[0]) ? t : o[0].replace(/\s+$/, "") + n;
|
|
211
205
|
}
|
|
212
|
-
function
|
|
206
|
+
function Ot(t, e, n, r = null) {
|
|
213
207
|
if (e === "")
|
|
214
208
|
return t;
|
|
215
209
|
const s = t.length;
|
|
@@ -224,7 +218,7 @@ function Wt(t, e, n, r = null) {
|
|
|
224
218
|
const i = t.slice(0, o), l = c.length, f = t.slice(o + l);
|
|
225
219
|
return i + e.slice(0, 1).repeat(l) + f;
|
|
226
220
|
}
|
|
227
|
-
function
|
|
221
|
+
function Nt(t, e) {
|
|
228
222
|
let n = "u", r = t;
|
|
229
223
|
if (t.length >= 2 && t[0] === "/") {
|
|
230
224
|
let s = -1;
|
|
@@ -253,7 +247,7 @@ function Ut(t, e) {
|
|
|
253
247
|
return "";
|
|
254
248
|
}
|
|
255
249
|
}
|
|
256
|
-
function
|
|
250
|
+
function Mt(t, e) {
|
|
257
251
|
e = String(e);
|
|
258
252
|
const n = typeof t == "string" ? [t] : Array.from(t);
|
|
259
253
|
for (const r of n) {
|
|
@@ -287,7 +281,7 @@ function It(t, e) {
|
|
|
287
281
|
}
|
|
288
282
|
return !1;
|
|
289
283
|
}
|
|
290
|
-
function
|
|
284
|
+
function Wt(t, e) {
|
|
291
285
|
let n = "u", r = t;
|
|
292
286
|
if (t.length >= 2 && t[0] === "/") {
|
|
293
287
|
let o = -1;
|
|
@@ -321,24 +315,24 @@ function Pt(t, e) {
|
|
|
321
315
|
}
|
|
322
316
|
return s;
|
|
323
317
|
}
|
|
324
|
-
function
|
|
318
|
+
function Ut(t) {
|
|
325
319
|
return S(t) ? t.map((e) => e.replace(/[^0-9]/g, "")) : t.replace(/[^0-9]/g, "");
|
|
326
320
|
}
|
|
327
|
-
function
|
|
321
|
+
function It(t, e, n = " ") {
|
|
328
322
|
const r = t.length;
|
|
329
323
|
if (e <= r || n === "")
|
|
330
324
|
return t;
|
|
331
325
|
const s = e - r, o = Math.floor(s / 2), c = s - o;
|
|
332
326
|
return z(n, o) + t + z(n, c);
|
|
333
327
|
}
|
|
334
|
-
function
|
|
328
|
+
function qt(t, e, n = " ") {
|
|
335
329
|
const r = t.length;
|
|
336
330
|
if (e <= r || n === "")
|
|
337
331
|
return t;
|
|
338
332
|
const o = e - r;
|
|
339
333
|
return z(n, o) + t;
|
|
340
334
|
}
|
|
341
|
-
function
|
|
335
|
+
function Gt(t, e, n = " ") {
|
|
342
336
|
const r = t.length;
|
|
343
337
|
if (e <= r || n === "")
|
|
344
338
|
return t;
|
|
@@ -350,14 +344,7 @@ function z(t, e) {
|
|
|
350
344
|
const n = Math.ceil(e / t.length);
|
|
351
345
|
return t.repeat(n).slice(0, e);
|
|
352
346
|
}
|
|
353
|
-
function
|
|
354
|
-
const n = t.split(/(?=[A-Z])/), r = String(n.pop());
|
|
355
|
-
return n.join("") + J(r, e);
|
|
356
|
-
}
|
|
357
|
-
function Tt(t, e = 2) {
|
|
358
|
-
return v(t, e);
|
|
359
|
-
}
|
|
360
|
-
function Zt(t = 32, e = !0, n = !0, r = !0, s = !1) {
|
|
347
|
+
function Pt(t = 32, e = !0, n = !0, r = !0, s = !1) {
|
|
361
348
|
const f = [
|
|
362
349
|
e ? [
|
|
363
350
|
"a",
|
|
@@ -462,7 +449,7 @@ function Zt(t = 32, e = !0, n = !0, r = !0, s = !1) {
|
|
|
462
449
|
}
|
|
463
450
|
return m.join("");
|
|
464
451
|
}
|
|
465
|
-
function
|
|
452
|
+
function jt(t, e, n = 0) {
|
|
466
453
|
if (e === "")
|
|
467
454
|
return !1;
|
|
468
455
|
const r = Array.from(t), s = Array.from(e);
|
|
@@ -482,29 +469,29 @@ function Jt(t, e, n = 0) {
|
|
|
482
469
|
}
|
|
483
470
|
return !1;
|
|
484
471
|
}
|
|
485
|
-
function
|
|
486
|
-
return (b ?? ((n) =>
|
|
472
|
+
function Y(t = 16) {
|
|
473
|
+
return (b ?? ((n) => J(n)))(t);
|
|
487
474
|
}
|
|
488
|
-
function
|
|
475
|
+
function v(t) {
|
|
489
476
|
b = t;
|
|
490
477
|
}
|
|
491
|
-
function
|
|
478
|
+
function Kt(t, e) {
|
|
492
479
|
let n = 0;
|
|
493
480
|
const r = e ?? function(s) {
|
|
494
481
|
const o = b;
|
|
495
482
|
b = null;
|
|
496
|
-
const c =
|
|
483
|
+
const c = Y(s);
|
|
497
484
|
return b = o, n++, c;
|
|
498
485
|
};
|
|
499
|
-
|
|
486
|
+
v((s) => n < t.length ? String(t[n++]) : r(s));
|
|
500
487
|
}
|
|
501
|
-
function
|
|
488
|
+
function Tt() {
|
|
502
489
|
b = null;
|
|
503
490
|
}
|
|
504
|
-
function
|
|
491
|
+
function Bt(t, e) {
|
|
505
492
|
return e <= 0 ? "" : t.repeat(e);
|
|
506
493
|
}
|
|
507
|
-
function
|
|
494
|
+
function Jt(t, e, n) {
|
|
508
495
|
let r;
|
|
509
496
|
typeof e == "object" && !S(e) ? r = Object.values(e) : r = S(e) ? [...e] : Array.from(e);
|
|
510
497
|
const s = n.split(t);
|
|
@@ -517,7 +504,7 @@ function Dt(t, e, n) {
|
|
|
517
504
|
}
|
|
518
505
|
return String(o);
|
|
519
506
|
}
|
|
520
|
-
function
|
|
507
|
+
function Zt(t, e) {
|
|
521
508
|
try {
|
|
522
509
|
const n = String(t);
|
|
523
510
|
if (n.length)
|
|
@@ -527,7 +514,7 @@ function Qt(t, e) {
|
|
|
527
514
|
return e;
|
|
528
515
|
}
|
|
529
516
|
}
|
|
530
|
-
function
|
|
517
|
+
function Ht(t, e, n, r = !0) {
|
|
531
518
|
const s = (f) => typeof f == "string" ? [f] : Array.from(f), o = s(t), c = s(e), i = (f) => f.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), l = (f) => o.reduce((m, u, a) => {
|
|
532
519
|
if (u === "") return m;
|
|
533
520
|
const p = c[a] ?? "";
|
|
@@ -536,27 +523,27 @@ function Xt(t, e, n, r = !0) {
|
|
|
536
523
|
const g = new RegExp(i(u), "gi");
|
|
537
524
|
return m.replace(g, () => p);
|
|
538
525
|
}, f);
|
|
539
|
-
return
|
|
526
|
+
return M(n) ? l(n) : Array.from(n).map(l);
|
|
540
527
|
}
|
|
541
|
-
function
|
|
528
|
+
function tt(t, e, n) {
|
|
542
529
|
if (t = String(t), t === "")
|
|
543
530
|
return n;
|
|
544
531
|
const r = n.indexOf(t);
|
|
545
532
|
return r !== -1 ? n.slice(0, r) + e + n.slice(r + t.length) : n;
|
|
546
533
|
}
|
|
547
|
-
function
|
|
548
|
-
return t = String(t), t === "" ? n : I(n, t) ?
|
|
534
|
+
function Vt(t, e, n) {
|
|
535
|
+
return t = String(t), t === "" ? n : I(n, t) ? tt(t, e, n) : n;
|
|
549
536
|
}
|
|
550
|
-
function
|
|
537
|
+
function et(t, e, n) {
|
|
551
538
|
if (t = String(t), t === "")
|
|
552
539
|
return n;
|
|
553
540
|
const r = n.lastIndexOf(t);
|
|
554
541
|
return r !== -1 ? n.slice(0, r) + e + n.slice(r + t.length) : n;
|
|
555
542
|
}
|
|
556
|
-
function
|
|
557
|
-
return t = String(t), t === "" ? n : W(n, t) ?
|
|
543
|
+
function Dt(t, e, n) {
|
|
544
|
+
return t = String(t), t === "" ? n : W(n, t) ? et(t, e, n) : n;
|
|
558
545
|
}
|
|
559
|
-
function
|
|
546
|
+
function Qt(t, e, n, r = -1) {
|
|
560
547
|
const s = (u) => S(u) ? u : [u], o = s(t);
|
|
561
548
|
function c(u) {
|
|
562
549
|
try {
|
|
@@ -600,7 +587,7 @@ function te(t, e, n, r = -1) {
|
|
|
600
587
|
if (!a) return null;
|
|
601
588
|
i.push(a);
|
|
602
589
|
}
|
|
603
|
-
const l =
|
|
590
|
+
const l = D(e), f = l ? [] : s(e), m = (u) => {
|
|
604
591
|
let a = u;
|
|
605
592
|
for (let p = 0; p < i.length; p++) {
|
|
606
593
|
const g = i[p];
|
|
@@ -613,20 +600,20 @@ function te(t, e, n, r = -1) {
|
|
|
613
600
|
if (r >= 0 && h >= r) return y;
|
|
614
601
|
h++;
|
|
615
602
|
const L = typeof w[w.length - 1] == "object" && typeof w[w.length - 2] == "number" ? w.length - 3 : w.length - 2, $ = [];
|
|
616
|
-
for (let
|
|
617
|
-
$.push(w[
|
|
618
|
-
const
|
|
619
|
-
return d(
|
|
603
|
+
for (let k = 0; k < L; k++)
|
|
604
|
+
$.push(w[k]);
|
|
605
|
+
const A = [y, ...$];
|
|
606
|
+
return d(A);
|
|
620
607
|
}
|
|
621
608
|
);
|
|
622
609
|
} else {
|
|
623
610
|
const h = f[p] ?? (f.length === 1 ? f[0] : "");
|
|
624
611
|
if (r < 0)
|
|
625
612
|
a = a.replace(g, (d, ...y) => {
|
|
626
|
-
const
|
|
627
|
-
return h.replace(/\$(\d{1,2})/g, ($,
|
|
628
|
-
const
|
|
629
|
-
return (L[
|
|
613
|
+
const _ = typeof y[y.length - 1] == "object" && typeof y[y.length - 2] == "number" ? y.length - 3 : y.length - 2, L = y.slice(0, _).map(($) => String($));
|
|
614
|
+
return h.replace(/\$(\d{1,2})/g, ($, A) => {
|
|
615
|
+
const k = parseInt(A, 10);
|
|
616
|
+
return (L[k - 1] ?? "").toUpperCase();
|
|
630
617
|
});
|
|
631
618
|
});
|
|
632
619
|
else {
|
|
@@ -634,10 +621,10 @@ function te(t, e, n, r = -1) {
|
|
|
634
621
|
a = a.replace(g, (y, ...w) => {
|
|
635
622
|
if (d >= r) return y;
|
|
636
623
|
d++;
|
|
637
|
-
const L = typeof w[w.length - 1] == "object" && typeof w[w.length - 2] == "number" ? w.length - 3 : w.length - 2, $ = w.slice(0, L).map((
|
|
638
|
-
return h.replace(/\$(\d{1,2})/g, (
|
|
639
|
-
const
|
|
640
|
-
return ($[
|
|
624
|
+
const L = typeof w[w.length - 1] == "object" && typeof w[w.length - 2] == "number" ? w.length - 3 : w.length - 2, $ = w.slice(0, L).map((A) => String(A));
|
|
625
|
+
return h.replace(/\$(\d{1,2})/g, (A, k) => {
|
|
626
|
+
const q = parseInt(k, 10);
|
|
627
|
+
return ($[q - 1] ?? "").toUpperCase();
|
|
641
628
|
});
|
|
642
629
|
});
|
|
643
630
|
}
|
|
@@ -647,10 +634,10 @@ function te(t, e, n, r = -1) {
|
|
|
647
634
|
};
|
|
648
635
|
return S(n) ? n.map(m) : m(n);
|
|
649
636
|
}
|
|
650
|
-
function
|
|
637
|
+
function nt(t) {
|
|
651
638
|
return t.replace(/<\/?[^>]+(>|$)/g, "");
|
|
652
639
|
}
|
|
653
|
-
function
|
|
640
|
+
function Xt(t, e, n = !0) {
|
|
654
641
|
const r = typeof t == "string" ? [t] : Array.from(t), s = (c) => c.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), o = (c) => {
|
|
655
642
|
let i = c;
|
|
656
643
|
for (const l of r)
|
|
@@ -665,21 +652,21 @@ function ee(t, e, n = !0) {
|
|
|
665
652
|
};
|
|
666
653
|
return typeof e == "string" ? o(e) : Array.from(e, (c) => o(String(c)));
|
|
667
654
|
}
|
|
668
|
-
function
|
|
655
|
+
function Yt(t) {
|
|
669
656
|
return Array.from(t).reverse().join("");
|
|
670
657
|
}
|
|
671
|
-
function
|
|
658
|
+
function vt(t, e) {
|
|
672
659
|
const n = e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
673
660
|
return e + t.replace(new RegExp(`^(?:${n})+`, "u"), "");
|
|
674
661
|
}
|
|
675
|
-
function
|
|
662
|
+
function te(t) {
|
|
676
663
|
const e = String(t).trim();
|
|
677
664
|
if (e === "")
|
|
678
665
|
return "";
|
|
679
666
|
let n = e.split(/\s+/u);
|
|
680
|
-
return n.length > 1 ? n = n.map((s) => j(s)) : n =
|
|
667
|
+
return n.length > 1 ? n = n.map((s) => j(s)) : n = ot(n.join("_")).map((s) => j(s)), n.join("_").replace(/[-_ ]+/gu, "_").split("_").filter((s) => s.length > 0).join(" ");
|
|
681
668
|
}
|
|
682
|
-
function
|
|
669
|
+
function ee(t) {
|
|
683
670
|
if (t.trim() === "")
|
|
684
671
|
return t;
|
|
685
672
|
const e = /* @__PURE__ */ new Set([
|
|
@@ -735,7 +722,7 @@ function oe(t) {
|
|
|
735
722
|
}
|
|
736
723
|
return r.join(" ");
|
|
737
724
|
}
|
|
738
|
-
function
|
|
725
|
+
function ne(t, e = "-", n = { "@": "at" }) {
|
|
739
726
|
const r = e, s = (u) => u.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"), o = (u) => u.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), c = (u) => {
|
|
740
727
|
let a = u;
|
|
741
728
|
const p = r === "-" ? "_" : "-";
|
|
@@ -769,18 +756,18 @@ function ie(t, e = "-", n = { "@": "at" }) {
|
|
|
769
756
|
);
|
|
770
757
|
return a = a.replace(d, ""), a;
|
|
771
758
|
}
|
|
772
|
-
}, i = c(t), l = c(
|
|
759
|
+
}, i = c(t), l = c(Z(t));
|
|
773
760
|
return Object.keys(n || {}).some((u) => /[A-Za-z0-9]/.test(u)) ? l : i;
|
|
774
761
|
}
|
|
775
|
-
function
|
|
762
|
+
function rt(t, e = "_") {
|
|
776
763
|
const r = `${t}|${e}`;
|
|
777
764
|
if (R.has(r))
|
|
778
765
|
return R.get(r);
|
|
779
766
|
let s = t;
|
|
780
|
-
return /^[a-z]+$/.test(t) || (s =
|
|
767
|
+
return /^[a-z]+$/.test(t) || (s = it(t).replace(/\s+/gu, ""), s = s.replace(/(.)(?=[A-Z])/g, `$1${e}`), s = U(s)), R.set(r, s), s;
|
|
781
768
|
}
|
|
782
|
-
function
|
|
783
|
-
return
|
|
769
|
+
function re(t) {
|
|
770
|
+
return H(t).replace(/[\s\u3164\u1160]+/gu, " ");
|
|
784
771
|
}
|
|
785
772
|
function I(t, e) {
|
|
786
773
|
if (t == null || e == null)
|
|
@@ -799,10 +786,10 @@ function I(t, e) {
|
|
|
799
786
|
}
|
|
800
787
|
return !1;
|
|
801
788
|
}
|
|
802
|
-
function
|
|
789
|
+
function se(t, e) {
|
|
803
790
|
return !I(t, e);
|
|
804
791
|
}
|
|
805
|
-
function
|
|
792
|
+
function B(t) {
|
|
806
793
|
const e = t;
|
|
807
794
|
if (C.has(e))
|
|
808
795
|
return C.get(e);
|
|
@@ -813,10 +800,10 @@ function Z(t) {
|
|
|
813
800
|
}, o = r.map(s).join("");
|
|
814
801
|
return C.set(e, o), o;
|
|
815
802
|
}
|
|
816
|
-
function
|
|
817
|
-
return
|
|
803
|
+
function oe(t) {
|
|
804
|
+
return B(t);
|
|
818
805
|
}
|
|
819
|
-
function
|
|
806
|
+
function ie(t, e) {
|
|
820
807
|
if (!t || Object.keys(t).length === 0)
|
|
821
808
|
return e;
|
|
822
809
|
const n = Object.keys(t).filter((o) => o !== "");
|
|
@@ -826,28 +813,28 @@ function ae(t, e) {
|
|
|
826
813
|
const r = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), s = new RegExp(n.map(r).join("|"), "gu");
|
|
827
814
|
return e.replace(s, (o) => t[o] ?? o);
|
|
828
815
|
}
|
|
829
|
-
function
|
|
816
|
+
function ce(t, e) {
|
|
830
817
|
return e < 0 ? x(t, e) : x(t, 0, e);
|
|
831
818
|
}
|
|
832
|
-
function
|
|
819
|
+
function st(t) {
|
|
833
820
|
return U(x(t, 0, 1)) + x(t, 1);
|
|
834
821
|
}
|
|
835
|
-
function
|
|
836
|
-
return
|
|
822
|
+
function le(t) {
|
|
823
|
+
return V(x(t, 0, 1)) + x(t, 1);
|
|
837
824
|
}
|
|
838
|
-
function
|
|
825
|
+
function ot(t) {
|
|
839
826
|
return t.split(new RegExp("(?=\\p{Lu})", "u")).filter(Boolean);
|
|
840
827
|
}
|
|
841
|
-
function
|
|
828
|
+
function it(t, e = ` \r
|
|
842
829
|
\f\v`) {
|
|
843
830
|
const n = S(e) ? e.join("") : e, r = (i) => i.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"), s = n.length ? r(n) : "", o = s.length ? `(?:\\s|[${s}])` : "\\s", c = new RegExp(`(^|${o})(\\p{Ll})`, "gu");
|
|
844
831
|
return t.replace(c, (i, l, f) => l + f.toUpperCase());
|
|
845
832
|
}
|
|
846
|
-
function
|
|
833
|
+
function fe(t, e = null) {
|
|
847
834
|
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, s = t.match(r);
|
|
848
835
|
return s ? s.length : 0;
|
|
849
836
|
}
|
|
850
|
-
function
|
|
837
|
+
function ae(t, e = 75, n = `
|
|
851
838
|
`, r = !1) {
|
|
852
839
|
if (t.length === 0 || e < 1 || n === "")
|
|
853
840
|
return t;
|
|
@@ -896,98 +883,95 @@ function me(t, e = 75, n = `
|
|
|
896
883
|
}
|
|
897
884
|
return o.join(n);
|
|
898
885
|
}
|
|
899
|
-
function
|
|
886
|
+
function ue() {
|
|
900
887
|
return R.size;
|
|
901
888
|
}
|
|
902
|
-
function
|
|
889
|
+
function pe() {
|
|
903
890
|
return E.size;
|
|
904
891
|
}
|
|
905
|
-
function
|
|
892
|
+
function ge() {
|
|
906
893
|
return C.size;
|
|
907
894
|
}
|
|
908
|
-
function
|
|
895
|
+
function me() {
|
|
909
896
|
R.clear(), E.clear(), C.clear();
|
|
910
897
|
}
|
|
911
898
|
export {
|
|
912
899
|
K as after,
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
900
|
+
at as afterLast,
|
|
901
|
+
ee as apa,
|
|
902
|
+
Q as before,
|
|
903
|
+
X as beforeLast,
|
|
904
|
+
ut as between,
|
|
905
|
+
pt as betweenFirst,
|
|
906
|
+
gt as camel,
|
|
907
|
+
pe as camelCacheSize,
|
|
908
|
+
mt as charAt,
|
|
909
|
+
dt as chopEnd,
|
|
910
|
+
ht as chopStart,
|
|
924
911
|
T as contains,
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
912
|
+
wt as containsAll,
|
|
913
|
+
Tt as createRandomStringsNormally,
|
|
914
|
+
v as createRandomStringsUsing,
|
|
915
|
+
Kt as createRandomStringsUsingSequence,
|
|
916
|
+
St as deduplicate,
|
|
917
|
+
xt as doesntContain,
|
|
918
|
+
$t as doesntEndWith,
|
|
919
|
+
se as doesntStartWith,
|
|
933
920
|
W as endsWith,
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
it as lcfirst,
|
|
921
|
+
yt as excerpt,
|
|
922
|
+
kt as finish,
|
|
923
|
+
me as flushCache,
|
|
924
|
+
te as headline,
|
|
925
|
+
Lt as is,
|
|
926
|
+
Rt as isAscii,
|
|
927
|
+
Et as isJson,
|
|
928
|
+
Mt as isMatch,
|
|
929
|
+
Ct as isUrl,
|
|
930
|
+
Ft as kebab,
|
|
931
|
+
st as lcfirst,
|
|
946
932
|
F as length,
|
|
947
|
-
|
|
933
|
+
zt as limit,
|
|
948
934
|
U as lower,
|
|
949
935
|
z as makePad,
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
ce as squish,
|
|
977
|
-
re as start,
|
|
936
|
+
Ot as mask,
|
|
937
|
+
Nt as match,
|
|
938
|
+
Wt as matchAll,
|
|
939
|
+
Ut as numbers,
|
|
940
|
+
It as padBoth,
|
|
941
|
+
qt as padLeft,
|
|
942
|
+
Gt as padRight,
|
|
943
|
+
oe as pascal,
|
|
944
|
+
Pt as password,
|
|
945
|
+
jt as position,
|
|
946
|
+
Y as random,
|
|
947
|
+
Xt as remove,
|
|
948
|
+
Bt as repeat,
|
|
949
|
+
Ht as replace,
|
|
950
|
+
Jt as replaceArray,
|
|
951
|
+
Dt as replaceEnd,
|
|
952
|
+
tt as replaceFirst,
|
|
953
|
+
et as replaceLast,
|
|
954
|
+
Qt as replaceMatches,
|
|
955
|
+
Vt as replaceStart,
|
|
956
|
+
Yt as reverse,
|
|
957
|
+
ne as slug,
|
|
958
|
+
rt as snake,
|
|
959
|
+
ue as snakeCacheSize,
|
|
960
|
+
re as squish,
|
|
961
|
+
vt as start,
|
|
978
962
|
I as startsWith,
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
963
|
+
nt as stripTags,
|
|
964
|
+
B as studly,
|
|
965
|
+
ge as studlyCacheSize,
|
|
966
|
+
ie as swap,
|
|
967
|
+
ce as take,
|
|
968
|
+
Zt as toStringOr,
|
|
969
|
+
le as ucfirst,
|
|
970
|
+
ot as ucsplit,
|
|
971
|
+
it as ucwords,
|
|
972
|
+
bt as unwrap,
|
|
973
|
+
fe as wordCount,
|
|
974
|
+
ae as wordWrap,
|
|
975
|
+
_t as words,
|
|
976
|
+
At as wrap
|
|
993
977
|
};
|