@tolki/str 1.0.9 → 1.0.11
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/README.md +19 -1
- package/dist/index.js +81 -79
- package/dist/str.d.ts +16 -0
- package/dist/str.d.ts.map +1 -1
- package/dist/str.js +213 -202
- package/dist/stringable/index.d.ts +6 -0
- package/dist/stringable/index.d.ts.map +1 -1
- package/dist/stringable/index.js +39 -31
- package/package.json +1 -1
package/dist/str.js
CHANGED
|
@@ -1,67 +1,69 @@
|
|
|
1
|
-
import { isArray as
|
|
2
|
-
import { title as I, upper as
|
|
3
|
-
import { randomInt as O, randomString as
|
|
4
|
-
import { substr as
|
|
5
|
-
import { ltrim as q, rtrim as G, trim as
|
|
1
|
+
import { isArray as S, toLower as U, isString as _, isFunction as Z, isNumber as j } from "@tolki/utils";
|
|
2
|
+
import { title as I, upper as T } from "./convertcase/index.js";
|
|
3
|
+
import { randomInt as O, randomString as D } from "./random/index.js";
|
|
4
|
+
import { substr as x } from "./replacer/index.js";
|
|
5
|
+
import { ltrim as q, rtrim as G, trim as Q } from "./trimmer/index.js";
|
|
6
|
+
import { createUlidsNormally as V } from "./ulid/index.js";
|
|
7
|
+
import { createUuidsNormally as X } from "./uuid/index.js";
|
|
6
8
|
const R = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map();
|
|
7
9
|
let L = null;
|
|
8
|
-
function
|
|
10
|
+
function B(t, e) {
|
|
9
11
|
if (e === "")
|
|
10
12
|
return t;
|
|
11
13
|
const n = String(e), r = t.indexOf(n);
|
|
12
14
|
return r === -1 ? t : t.slice(r + n.length);
|
|
13
15
|
}
|
|
14
|
-
function
|
|
16
|
+
function wt(t, e) {
|
|
15
17
|
if (e === "")
|
|
16
18
|
return t;
|
|
17
19
|
const n = t.lastIndexOf(String(e));
|
|
18
20
|
return n === -1 ? t : t.slice(n + String(e).length);
|
|
19
21
|
}
|
|
20
|
-
function
|
|
22
|
+
function Y(t, e) {
|
|
21
23
|
if (e === "")
|
|
22
24
|
return t;
|
|
23
25
|
const n = t.indexOf(String(e));
|
|
24
26
|
return n === -1 ? t : t.slice(0, n);
|
|
25
27
|
}
|
|
26
|
-
function
|
|
28
|
+
function v(t, e) {
|
|
27
29
|
if (e === "")
|
|
28
30
|
return t;
|
|
29
31
|
const n = t.lastIndexOf(String(e));
|
|
30
|
-
return n === -1 ? t :
|
|
32
|
+
return n === -1 ? t : x(t, 0, n);
|
|
31
33
|
}
|
|
32
|
-
function
|
|
33
|
-
return e === "" || n === "" ? t :
|
|
34
|
+
function St(t, e, n) {
|
|
35
|
+
return e === "" || n === "" ? t : v(B(t, e), n);
|
|
34
36
|
}
|
|
35
|
-
function
|
|
36
|
-
return e === "" || n === "" ? t :
|
|
37
|
+
function xt(t, e, n) {
|
|
38
|
+
return e === "" || n === "" ? t : Y(B(t, e), n);
|
|
37
39
|
}
|
|
38
|
-
function
|
|
40
|
+
function $t(t) {
|
|
39
41
|
if (C.has(t))
|
|
40
42
|
return C.get(t);
|
|
41
|
-
const e =
|
|
43
|
+
const e = ct(K(t));
|
|
42
44
|
return C.set(t, e), e;
|
|
43
45
|
}
|
|
44
|
-
function
|
|
46
|
+
function kt(t, e) {
|
|
45
47
|
const n = t.length;
|
|
46
48
|
return (e < 0 ? e < -n : e > n - 1) ? !1 : (e < 0 && (e += n), t.charAt(e));
|
|
47
49
|
}
|
|
48
|
-
function
|
|
49
|
-
for (const n of
|
|
50
|
+
function At(t, e) {
|
|
51
|
+
for (const n of S(e) ? e : [e])
|
|
50
52
|
if (n !== "" && t.startsWith(n)) {
|
|
51
53
|
const r = [...t], s = [...n];
|
|
52
54
|
return r.slice(s.length).join("");
|
|
53
55
|
}
|
|
54
56
|
return t;
|
|
55
57
|
}
|
|
56
|
-
function
|
|
57
|
-
for (const n of
|
|
58
|
+
function bt(t, e) {
|
|
59
|
+
for (const n of S(e) ? e : [e])
|
|
58
60
|
if (n !== "" && t.endsWith(n)) {
|
|
59
61
|
const r = [...t], s = [...n];
|
|
60
62
|
return r.slice(0, -s.length).join("");
|
|
61
63
|
}
|
|
62
64
|
return t;
|
|
63
65
|
}
|
|
64
|
-
function
|
|
66
|
+
function H(t, e, n = !1) {
|
|
65
67
|
n && (t = t.toLowerCase());
|
|
66
68
|
let r;
|
|
67
69
|
typeof e == "string" ? r = [e] : r = Array.from(e);
|
|
@@ -70,59 +72,59 @@ function B(t, e, n = !1) {
|
|
|
70
72
|
return !0;
|
|
71
73
|
return !1;
|
|
72
74
|
}
|
|
73
|
-
function
|
|
75
|
+
function Et(t, e = "", n = {}) {
|
|
74
76
|
const { radius: r = 100, omission: s = "..." } = n, o = String(t ?? ""), c = e ?? "", i = ($) => $.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), l = new RegExp(`^(.*?)(${i(c)})(.*)$`, "iu").exec(o);
|
|
75
77
|
if (!l)
|
|
76
78
|
return null;
|
|
77
|
-
const p = String(l[1]), a = String(l[2]), g = String(l[3]), u = q(p), m = Array.from(u).length, y =
|
|
79
|
+
const p = String(l[1]), a = String(l[2]), g = String(l[3]), u = q(p), m = Array.from(u).length, y = x(u, Math.max(m - r, 0), r);
|
|
78
80
|
let w = q(y);
|
|
79
81
|
w !== u && (w = s + w);
|
|
80
|
-
const h = G(g), d =
|
|
82
|
+
const h = G(g), d = x(h, 0, r);
|
|
81
83
|
let k = G(d);
|
|
82
84
|
return k !== h && (k = k + s), w + a + k;
|
|
83
85
|
}
|
|
84
|
-
function
|
|
86
|
+
function Lt(t, e, n = !1) {
|
|
85
87
|
for (const r of e)
|
|
86
|
-
if (!
|
|
88
|
+
if (!H(t, r, n))
|
|
87
89
|
return !1;
|
|
88
90
|
return !0;
|
|
89
91
|
}
|
|
90
|
-
function
|
|
91
|
-
return !
|
|
92
|
+
function Rt(t, e, n = !1) {
|
|
93
|
+
return !H(t, e, n);
|
|
92
94
|
}
|
|
93
|
-
function
|
|
94
|
-
return
|
|
95
|
+
function Ct(t, e = " ") {
|
|
96
|
+
return S(e) ? (e.forEach((n) => {
|
|
95
97
|
t = t.replace(new RegExp(`${n}+`, "g"), n);
|
|
96
98
|
}), t) : t.replace(new RegExp(`${e}+`, "g"), e);
|
|
97
99
|
}
|
|
98
|
-
function
|
|
100
|
+
function W(t, e) {
|
|
99
101
|
if (t === null)
|
|
100
102
|
return !1;
|
|
101
|
-
t = String(t),
|
|
103
|
+
t = String(t), S(e) ? e = Array.from(e) : e = [String(e)];
|
|
102
104
|
for (const n of e)
|
|
103
105
|
if (n !== "" && t.endsWith(n))
|
|
104
106
|
return !0;
|
|
105
107
|
return !1;
|
|
106
108
|
}
|
|
107
|
-
function
|
|
108
|
-
return !
|
|
109
|
+
function Ft(t, e) {
|
|
110
|
+
return !W(t, e);
|
|
109
111
|
}
|
|
110
|
-
function
|
|
112
|
+
function Nt(t, e) {
|
|
111
113
|
const n = e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
112
114
|
return t.replace(new RegExp(`(?:${n})+$`, "u"), "") + e;
|
|
113
115
|
}
|
|
114
|
-
function
|
|
116
|
+
function zt(t, e, n = null) {
|
|
115
117
|
return e + t + (n ?? e);
|
|
116
118
|
}
|
|
117
|
-
function
|
|
118
|
-
return
|
|
119
|
+
function _t(t, e, n = null) {
|
|
120
|
+
return M(t, e) && (t = x(t, N(e))), W(t, n ??= e) && (t = x(t, 0, -N(n))), t;
|
|
119
121
|
}
|
|
120
|
-
function
|
|
122
|
+
function Ot(t, e, n = !1) {
|
|
121
123
|
e = String(e);
|
|
122
124
|
let r;
|
|
123
125
|
typeof t == "string" ? r = [t] : r = Array.from(t);
|
|
124
126
|
for (let s of r) {
|
|
125
|
-
if (s = String(s), s === e || n &&
|
|
127
|
+
if (s = String(s), s === e || n && U(s) === U(e))
|
|
126
128
|
return !0;
|
|
127
129
|
s = s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), s = s.replace(/\\\*/g, ".*");
|
|
128
130
|
const o = n ? "iu" : "u";
|
|
@@ -131,13 +133,13 @@ function Ct(t, e, n = !1) {
|
|
|
131
133
|
}
|
|
132
134
|
return !1;
|
|
133
135
|
}
|
|
134
|
-
function
|
|
136
|
+
function Ut(t) {
|
|
135
137
|
for (let e = 0; e < t.length; e++)
|
|
136
138
|
if (t.charCodeAt(e) > 127)
|
|
137
139
|
return !1;
|
|
138
140
|
return !0;
|
|
139
141
|
}
|
|
140
|
-
function
|
|
142
|
+
function Wt(t) {
|
|
141
143
|
if (!_(t))
|
|
142
144
|
return !1;
|
|
143
145
|
try {
|
|
@@ -147,7 +149,7 @@ function zt(t) {
|
|
|
147
149
|
}
|
|
148
150
|
return !0;
|
|
149
151
|
}
|
|
150
|
-
function
|
|
152
|
+
function Mt(t, e = []) {
|
|
151
153
|
if (!_(t))
|
|
152
154
|
return !1;
|
|
153
155
|
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("|");
|
|
@@ -177,31 +179,31 @@ function Nt(t, e = []) {
|
|
|
177
179
|
].join("");
|
|
178
180
|
return new RegExp(s, "iu").test(t);
|
|
179
181
|
}
|
|
180
|
-
function
|
|
181
|
-
return
|
|
182
|
+
function Pt(t) {
|
|
183
|
+
return it(t, "-");
|
|
182
184
|
}
|
|
183
|
-
function
|
|
185
|
+
function N(t) {
|
|
184
186
|
return t.length;
|
|
185
187
|
}
|
|
186
|
-
function
|
|
188
|
+
function It(t, e = 100, n = "...", r = !1) {
|
|
187
189
|
if (t.length <= e)
|
|
188
190
|
return t;
|
|
189
191
|
if (!r)
|
|
190
192
|
return t.slice(0, e).replace(/\s+$/, "") + n;
|
|
191
|
-
t =
|
|
193
|
+
t = ot(t).replace(/[\n\r]+/g, " ").trim();
|
|
192
194
|
const s = t.slice(0, e).replace(/\s+$/, "");
|
|
193
195
|
return t.substring(e, e + 1) === " " ? s + n : s.replace(/(.*)\s.*/, "$1") + n;
|
|
194
196
|
}
|
|
195
|
-
function
|
|
196
|
-
return
|
|
197
|
+
function J(t) {
|
|
198
|
+
return U(t);
|
|
197
199
|
}
|
|
198
|
-
function
|
|
200
|
+
function qt(t, e = 100, n = "...") {
|
|
199
201
|
if (e <= 0)
|
|
200
202
|
return t;
|
|
201
203
|
const r = e, s = new RegExp(`^\\s*(?:\\S+\\s*){1,${r}}`, "u"), o = t.match(s);
|
|
202
|
-
return !o ||
|
|
204
|
+
return !o || N(t) === N(o[0]) ? t : o[0].trimEnd() + n;
|
|
203
205
|
}
|
|
204
|
-
function
|
|
206
|
+
function Gt(t, e, n, r = null) {
|
|
205
207
|
if (e === "")
|
|
206
208
|
return t;
|
|
207
209
|
const s = t.length;
|
|
@@ -216,7 +218,7 @@ function Mt(t, e, n, r = null) {
|
|
|
216
218
|
const i = t.slice(0, o), f = c.length, l = t.slice(o + f);
|
|
217
219
|
return i + e.slice(0, 1).repeat(f) + l;
|
|
218
220
|
}
|
|
219
|
-
function
|
|
221
|
+
function Tt(t, e) {
|
|
220
222
|
let n = "u", r = t;
|
|
221
223
|
if (t.length >= 2 && t[0] === "/") {
|
|
222
224
|
let s = -1;
|
|
@@ -245,7 +247,7 @@ function Ut(t, e) {
|
|
|
245
247
|
return "";
|
|
246
248
|
}
|
|
247
249
|
}
|
|
248
|
-
function
|
|
250
|
+
function Bt(t, e) {
|
|
249
251
|
e = String(e);
|
|
250
252
|
const n = typeof t == "string" ? [t] : Array.from(t);
|
|
251
253
|
for (const r of n) {
|
|
@@ -279,7 +281,7 @@ function Pt(t, e) {
|
|
|
279
281
|
}
|
|
280
282
|
return !1;
|
|
281
283
|
}
|
|
282
|
-
function
|
|
284
|
+
function Ht(t, e) {
|
|
283
285
|
let n = "u", r = t;
|
|
284
286
|
if (t.length >= 2 && t[0] === "/") {
|
|
285
287
|
let o = -1;
|
|
@@ -313,37 +315,37 @@ function It(t, e) {
|
|
|
313
315
|
}
|
|
314
316
|
return s;
|
|
315
317
|
}
|
|
316
|
-
function
|
|
317
|
-
return
|
|
318
|
+
function Jt(t) {
|
|
319
|
+
return S(t) ? t.map((e) => e.replace(/[^0-9]/g, "")) : t.replace(/[^0-9]/g, "");
|
|
318
320
|
}
|
|
319
|
-
function
|
|
321
|
+
function Kt(t, e, n = " ") {
|
|
320
322
|
const r = t.length;
|
|
321
323
|
if (e <= r || n === "")
|
|
322
324
|
return t;
|
|
323
325
|
const s = e - r, o = Math.floor(s / 2), c = s - o;
|
|
324
|
-
return
|
|
326
|
+
return z(n, o) + t + z(n, c);
|
|
325
327
|
}
|
|
326
|
-
function
|
|
328
|
+
function Zt(t, e, n = " ") {
|
|
327
329
|
const r = t.length;
|
|
328
330
|
if (e <= r || n === "")
|
|
329
331
|
return t;
|
|
330
332
|
const o = e - r;
|
|
331
|
-
return
|
|
333
|
+
return z(n, o) + t;
|
|
332
334
|
}
|
|
333
|
-
function
|
|
335
|
+
function jt(t, e, n = " ") {
|
|
334
336
|
const r = t.length;
|
|
335
337
|
if (e <= r || n === "")
|
|
336
338
|
return t;
|
|
337
339
|
const o = e - r;
|
|
338
|
-
return t +
|
|
340
|
+
return t + z(n, o);
|
|
339
341
|
}
|
|
340
|
-
function
|
|
342
|
+
function z(t, e) {
|
|
341
343
|
if (e <= 0 || t.length === 0)
|
|
342
344
|
return "";
|
|
343
345
|
const n = Math.ceil(e / t.length);
|
|
344
346
|
return t.repeat(n).slice(0, e);
|
|
345
347
|
}
|
|
346
|
-
function
|
|
348
|
+
function Dt(t = 32, e = !0, n = !0, r = !0, s = !1) {
|
|
347
349
|
const l = [
|
|
348
350
|
e ? [
|
|
349
351
|
"a",
|
|
@@ -429,7 +431,7 @@ function Ht(t = 32, e = !0, n = !0, r = !0, s = !1) {
|
|
|
429
431
|
";"
|
|
430
432
|
] : null,
|
|
431
433
|
s ? [" "] : null
|
|
432
|
-
].filter((u) =>
|
|
434
|
+
].filter((u) => S(u));
|
|
433
435
|
if (l.length === 0 || t <= 0)
|
|
434
436
|
return "";
|
|
435
437
|
const p = [];
|
|
@@ -448,7 +450,7 @@ function Ht(t = 32, e = !0, n = !0, r = !0, s = !1) {
|
|
|
448
450
|
}
|
|
449
451
|
return p.join("");
|
|
450
452
|
}
|
|
451
|
-
function
|
|
453
|
+
function Qt(t, e, n = 0) {
|
|
452
454
|
if (e === "")
|
|
453
455
|
return !1;
|
|
454
456
|
const r = Array.from(t), s = Array.from(e);
|
|
@@ -468,31 +470,31 @@ function Jt(t, e, n = 0) {
|
|
|
468
470
|
}
|
|
469
471
|
return !1;
|
|
470
472
|
}
|
|
471
|
-
function
|
|
472
|
-
return (L ?? ((n) =>
|
|
473
|
+
function tt(t = 16) {
|
|
474
|
+
return (L ?? ((n) => D(n)))(t);
|
|
473
475
|
}
|
|
474
|
-
function
|
|
476
|
+
function et(t) {
|
|
475
477
|
L = t;
|
|
476
478
|
}
|
|
477
|
-
function
|
|
479
|
+
function Vt(t, e) {
|
|
478
480
|
let n = 0;
|
|
479
481
|
const r = e ?? function(s) {
|
|
480
482
|
const o = L;
|
|
481
483
|
L = null;
|
|
482
|
-
const c =
|
|
484
|
+
const c = tt(s);
|
|
483
485
|
return L = o, n++, c;
|
|
484
486
|
};
|
|
485
|
-
|
|
487
|
+
et((s) => n < t.length ? String(t[n++]) : r(s));
|
|
486
488
|
}
|
|
487
|
-
function
|
|
489
|
+
function nt() {
|
|
488
490
|
L = null;
|
|
489
491
|
}
|
|
490
|
-
function
|
|
492
|
+
function Xt(t, e) {
|
|
491
493
|
return e <= 0 ? "" : t.repeat(e);
|
|
492
494
|
}
|
|
493
|
-
function
|
|
495
|
+
function Yt(t, e, n) {
|
|
494
496
|
let r;
|
|
495
|
-
typeof e == "object" && !
|
|
497
|
+
typeof e == "object" && !S(e) ? r = Object.values(e) : r = S(e) ? [...e] : Array.from(e);
|
|
496
498
|
const s = n.split(t);
|
|
497
499
|
if (s.length === 1)
|
|
498
500
|
return n;
|
|
@@ -503,7 +505,7 @@ function Qt(t, e, n) {
|
|
|
503
505
|
}
|
|
504
506
|
return String(o);
|
|
505
507
|
}
|
|
506
|
-
function
|
|
508
|
+
function vt(t, e) {
|
|
507
509
|
try {
|
|
508
510
|
const n = String(t);
|
|
509
511
|
if (n.length)
|
|
@@ -513,7 +515,7 @@ function Vt(t, e) {
|
|
|
513
515
|
return e;
|
|
514
516
|
}
|
|
515
517
|
}
|
|
516
|
-
function
|
|
518
|
+
function te(t, e, n, r = !0) {
|
|
517
519
|
const s = (l) => typeof l == "string" ? [l] : Array.from(l), o = s(t), c = s(e), i = (l) => l.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = (l) => o.reduce((p, a, g) => {
|
|
518
520
|
if (a === "") return p;
|
|
519
521
|
const u = c[g] ?? "";
|
|
@@ -524,26 +526,26 @@ function Xt(t, e, n, r = !0) {
|
|
|
524
526
|
}, l);
|
|
525
527
|
return _(n) ? f(n) : Array.from(n).map(f);
|
|
526
528
|
}
|
|
527
|
-
function
|
|
529
|
+
function rt(t, e, n) {
|
|
528
530
|
if (t = String(t), t === "")
|
|
529
531
|
return n;
|
|
530
532
|
const r = n.indexOf(t);
|
|
531
533
|
return r !== -1 ? n.slice(0, r) + e + n.slice(r + t.length) : n;
|
|
532
534
|
}
|
|
533
|
-
function
|
|
534
|
-
return t = String(t), t === "" ? n :
|
|
535
|
+
function ee(t, e, n) {
|
|
536
|
+
return t = String(t), t === "" ? n : M(n, t) ? rt(t, e, n) : n;
|
|
535
537
|
}
|
|
536
|
-
function
|
|
538
|
+
function st(t, e, n) {
|
|
537
539
|
if (t = String(t), t === "")
|
|
538
540
|
return n;
|
|
539
541
|
const r = n.lastIndexOf(t);
|
|
540
542
|
return r !== -1 ? n.slice(0, r) + e + n.slice(r + t.length) : n;
|
|
541
543
|
}
|
|
542
|
-
function
|
|
543
|
-
return t = String(t), t === "" ? n :
|
|
544
|
+
function ne(t, e, n) {
|
|
545
|
+
return t = String(t), t === "" ? n : W(n, t) ? st(t, e, n) : n;
|
|
544
546
|
}
|
|
545
|
-
function
|
|
546
|
-
const s = (a) =>
|
|
547
|
+
function re(t, e, n, r = -1) {
|
|
548
|
+
const s = (a) => S(a) ? a : [a], o = s(t);
|
|
547
549
|
function c(a) {
|
|
548
550
|
try {
|
|
549
551
|
if (a instanceof RegExp) {
|
|
@@ -585,7 +587,7 @@ function vt(t, e, n, r = -1) {
|
|
|
585
587
|
if (!g) return null;
|
|
586
588
|
i.push(g);
|
|
587
589
|
}
|
|
588
|
-
const f =
|
|
590
|
+
const f = Z(e), l = f ? [] : s(e), p = (a) => {
|
|
589
591
|
let g = a;
|
|
590
592
|
for (let u = 0; u < i.length; u++) {
|
|
591
593
|
const m = i[u];
|
|
@@ -630,9 +632,9 @@ function vt(t, e, n, r = -1) {
|
|
|
630
632
|
}
|
|
631
633
|
return g;
|
|
632
634
|
};
|
|
633
|
-
return
|
|
635
|
+
return S(n) ? n.map(p) : p(n);
|
|
634
636
|
}
|
|
635
|
-
function
|
|
637
|
+
function ot(t) {
|
|
636
638
|
let e = "", n = !1;
|
|
637
639
|
for (let r = 0; r < t.length; r++) {
|
|
638
640
|
const s = t[r];
|
|
@@ -640,7 +642,7 @@ function nt(t) {
|
|
|
640
642
|
}
|
|
641
643
|
return e;
|
|
642
644
|
}
|
|
643
|
-
function
|
|
645
|
+
function se(t, e, n = !0) {
|
|
644
646
|
const r = typeof t == "string" ? [t] : Array.from(t), s = (c) => c.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), o = (c) => {
|
|
645
647
|
let i = c;
|
|
646
648
|
for (const f of r)
|
|
@@ -655,21 +657,25 @@ function te(t, e, n = !0) {
|
|
|
655
657
|
};
|
|
656
658
|
return typeof e == "string" ? o(e) : Array.from(e, (c) => o(String(c)));
|
|
657
659
|
}
|
|
658
|
-
function
|
|
660
|
+
function oe(t) {
|
|
659
661
|
return Array.from(t).reverse().join("");
|
|
660
662
|
}
|
|
661
|
-
function
|
|
663
|
+
function ie(t, e) {
|
|
662
664
|
const n = e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
663
665
|
return e + t.replace(new RegExp(`^(?:${n})+`, "u"), "");
|
|
664
666
|
}
|
|
665
|
-
function
|
|
667
|
+
function ce(t) {
|
|
666
668
|
const e = String(t).trim();
|
|
667
669
|
if (e === "")
|
|
668
670
|
return "";
|
|
669
671
|
let n = e.split(/\s+/u);
|
|
670
|
-
return n.length > 1 ? n = n.map((s) => I(s)) : n =
|
|
672
|
+
return n.length > 1 ? n = n.map((s) => I(s)) : n = lt(n.join("_")).map((s) => I(s)), n.join("_").replace(/[-_ ]+/gu, "_").split("_").filter((s) => s.length > 0).join(" ");
|
|
673
|
+
}
|
|
674
|
+
function le(t, e = !1) {
|
|
675
|
+
const r = t.split(/\s+/u).filter((s) => s.length > 0).map((s) => [...s][0]).join("");
|
|
676
|
+
return e ? T(r) : r;
|
|
671
677
|
}
|
|
672
|
-
function
|
|
678
|
+
function fe(t) {
|
|
673
679
|
if (t.trim() === "")
|
|
674
680
|
return t;
|
|
675
681
|
const e = /* @__PURE__ */ new Set([
|
|
@@ -725,21 +731,21 @@ function se(t) {
|
|
|
725
731
|
}
|
|
726
732
|
return r.join(" ");
|
|
727
733
|
}
|
|
728
|
-
function
|
|
734
|
+
function it(t, e = "_") {
|
|
729
735
|
const r = `${t}|${e}`;
|
|
730
736
|
if (R.has(r))
|
|
731
737
|
return R.get(r);
|
|
732
738
|
let s = t;
|
|
733
|
-
return /^[a-z]+$/.test(t) || (s =
|
|
739
|
+
return /^[a-z]+$/.test(t) || (s = ft(t).replace(/\s+/gu, ""), s = s.replace(/(.)(?=[A-Z])/g, `$1${e}`), s = J(s)), R.set(r, s), s;
|
|
734
740
|
}
|
|
735
|
-
function
|
|
736
|
-
return
|
|
741
|
+
function ae(t) {
|
|
742
|
+
return Q(t).replace(/[\s\u3164\u1160]+/gu, " ");
|
|
737
743
|
}
|
|
738
|
-
function
|
|
744
|
+
function M(t, e) {
|
|
739
745
|
if (t == null || e == null)
|
|
740
746
|
return !1;
|
|
741
747
|
let n;
|
|
742
|
-
_(e) ||
|
|
748
|
+
_(e) || j(e) ? n = [e] : Symbol.iterator in Object(e) ? n = Array.from(e) : n = [e];
|
|
743
749
|
const r = String(t);
|
|
744
750
|
for (const s of n) {
|
|
745
751
|
if (s == null)
|
|
@@ -750,10 +756,10 @@ function U(t, e) {
|
|
|
750
756
|
}
|
|
751
757
|
return !1;
|
|
752
758
|
}
|
|
753
|
-
function
|
|
754
|
-
return !
|
|
759
|
+
function ue(t, e) {
|
|
760
|
+
return !M(t, e);
|
|
755
761
|
}
|
|
756
|
-
function
|
|
762
|
+
function K(t) {
|
|
757
763
|
const e = t;
|
|
758
764
|
if (F.has(e))
|
|
759
765
|
return F.get(e);
|
|
@@ -764,10 +770,10 @@ function J(t) {
|
|
|
764
770
|
}, o = r.map(s).join("");
|
|
765
771
|
return F.set(e, o), o;
|
|
766
772
|
}
|
|
767
|
-
function
|
|
768
|
-
return
|
|
773
|
+
function pe(t) {
|
|
774
|
+
return K(t);
|
|
769
775
|
}
|
|
770
|
-
function
|
|
776
|
+
function ge(t, e) {
|
|
771
777
|
if (!t || Object.keys(t).length === 0)
|
|
772
778
|
return e;
|
|
773
779
|
const n = Object.keys(t).filter((o) => o !== "");
|
|
@@ -777,28 +783,28 @@ function le(t, e) {
|
|
|
777
783
|
const r = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), s = new RegExp(n.map(r).join("|"), "gu");
|
|
778
784
|
return e.replace(s, (o) => t[o]);
|
|
779
785
|
}
|
|
780
|
-
function
|
|
781
|
-
return e < 0 ?
|
|
786
|
+
function me(t, e) {
|
|
787
|
+
return e < 0 ? x(t, e) : x(t, 0, e);
|
|
782
788
|
}
|
|
783
|
-
function
|
|
784
|
-
return
|
|
789
|
+
function ct(t) {
|
|
790
|
+
return J(x(t, 0, 1)) + x(t, 1);
|
|
785
791
|
}
|
|
786
|
-
function
|
|
787
|
-
return
|
|
792
|
+
function he(t) {
|
|
793
|
+
return T(x(t, 0, 1)) + x(t, 1);
|
|
788
794
|
}
|
|
789
|
-
function
|
|
795
|
+
function lt(t) {
|
|
790
796
|
return t.split(new RegExp("(?=\\p{Lu})", "u")).filter(Boolean);
|
|
791
797
|
}
|
|
792
|
-
function
|
|
798
|
+
function ft(t, e = ` \r
|
|
793
799
|
\f\v`) {
|
|
794
|
-
const n =
|
|
800
|
+
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");
|
|
795
801
|
return t.replace(c, (i, f, l) => f + l.toUpperCase());
|
|
796
802
|
}
|
|
797
|
-
function
|
|
803
|
+
function de(t, e = null) {
|
|
798
804
|
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);
|
|
799
805
|
return s ? s.length : 0;
|
|
800
806
|
}
|
|
801
|
-
function
|
|
807
|
+
function ye(t, e = 75, n = `
|
|
802
808
|
`, r = !1) {
|
|
803
809
|
if (t.length === 0 || e < 1 || n === "")
|
|
804
810
|
return t;
|
|
@@ -847,94 +853,99 @@ function pe(t, e = 75, n = `
|
|
|
847
853
|
}
|
|
848
854
|
return o.join(n);
|
|
849
855
|
}
|
|
850
|
-
function
|
|
856
|
+
function we() {
|
|
851
857
|
return R.size;
|
|
852
858
|
}
|
|
853
|
-
function
|
|
859
|
+
function Se() {
|
|
854
860
|
return C.size;
|
|
855
861
|
}
|
|
856
|
-
function
|
|
862
|
+
function xe() {
|
|
857
863
|
return F.size;
|
|
858
864
|
}
|
|
859
|
-
function
|
|
865
|
+
function $e() {
|
|
860
866
|
R.clear(), C.clear(), F.clear();
|
|
861
867
|
}
|
|
868
|
+
function ke() {
|
|
869
|
+
nt(), V(), X();
|
|
870
|
+
}
|
|
862
871
|
export {
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
Xt as
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
ee as
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
872
|
+
B as after,
|
|
873
|
+
wt as afterLast,
|
|
874
|
+
fe as apa,
|
|
875
|
+
Y as before,
|
|
876
|
+
v as beforeLast,
|
|
877
|
+
St as between,
|
|
878
|
+
xt as betweenFirst,
|
|
879
|
+
$t as camel,
|
|
880
|
+
Se as camelCacheSize,
|
|
881
|
+
kt as charAt,
|
|
882
|
+
bt as chopEnd,
|
|
883
|
+
At as chopStart,
|
|
884
|
+
H as contains,
|
|
885
|
+
Lt as containsAll,
|
|
886
|
+
nt as createRandomStringsNormally,
|
|
887
|
+
et as createRandomStringsUsing,
|
|
888
|
+
Vt as createRandomStringsUsingSequence,
|
|
889
|
+
Ct as deduplicate,
|
|
890
|
+
Rt as doesntContain,
|
|
891
|
+
Ft as doesntEndWith,
|
|
892
|
+
ue as doesntStartWith,
|
|
893
|
+
W as endsWith,
|
|
894
|
+
Et as excerpt,
|
|
895
|
+
Nt as finish,
|
|
896
|
+
$e as flushCache,
|
|
897
|
+
ce as headline,
|
|
898
|
+
le as initials,
|
|
899
|
+
Ot as is,
|
|
900
|
+
Ut as isAscii,
|
|
901
|
+
Wt as isJson,
|
|
902
|
+
Bt as isMatch,
|
|
903
|
+
Mt as isUrl,
|
|
904
|
+
Pt as kebab,
|
|
905
|
+
ct as lcfirst,
|
|
906
|
+
N as length,
|
|
907
|
+
It as limit,
|
|
908
|
+
J as lower,
|
|
909
|
+
z as makePad,
|
|
910
|
+
Gt as mask,
|
|
911
|
+
Tt as match,
|
|
912
|
+
Ht as matchAll,
|
|
913
|
+
Jt as numbers,
|
|
914
|
+
Kt as padBoth,
|
|
915
|
+
Zt as padLeft,
|
|
916
|
+
jt as padRight,
|
|
917
|
+
pe as pascal,
|
|
918
|
+
Dt as password,
|
|
919
|
+
Qt as position,
|
|
920
|
+
tt as random,
|
|
921
|
+
se as remove,
|
|
922
|
+
Xt as repeat,
|
|
923
|
+
te as replace,
|
|
924
|
+
Yt as replaceArray,
|
|
925
|
+
ne as replaceEnd,
|
|
926
|
+
rt as replaceFirst,
|
|
927
|
+
st as replaceLast,
|
|
928
|
+
re as replaceMatches,
|
|
929
|
+
ee as replaceStart,
|
|
930
|
+
ke as resetFactoryState,
|
|
931
|
+
oe as reverse,
|
|
932
|
+
it as snake,
|
|
933
|
+
we as snakeCacheSize,
|
|
934
|
+
ae as squish,
|
|
935
|
+
ie as start,
|
|
936
|
+
M as startsWith,
|
|
937
|
+
ot as stripTags,
|
|
938
|
+
K as studly,
|
|
939
|
+
xe as studlyCacheSize,
|
|
940
|
+
ge as swap,
|
|
941
|
+
me as take,
|
|
942
|
+
vt as toStringOr,
|
|
943
|
+
he as ucfirst,
|
|
944
|
+
lt as ucsplit,
|
|
945
|
+
ft as ucwords,
|
|
946
|
+
_t as unwrap,
|
|
947
|
+
de as wordCount,
|
|
948
|
+
ye as wordWrap,
|
|
949
|
+
qt as words,
|
|
950
|
+
zt as wrap
|
|
940
951
|
};
|