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