@tolki/str 1.5.0 → 1.6.0
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 +7 -1
- package/dist/str.d.ts +3 -5
- package/dist/str.d.ts.map +1 -1
- package/dist/str.js +265 -267
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1018,7 +1018,7 @@ const result = pluralPascal("HelloWorld");
|
|
|
1018
1018
|
|
|
1019
1019
|
`password`, `random`, `ulid`, `uuid`, and `uuid7` (along with their `createXUsing`/`createXNormally` testing helpers) generate a new value on every call, so a live playground would just show a different, unverifiable result each time you touch it — there's no live example for these.
|
|
1020
1020
|
|
|
1021
|
-
Generate a random, secure password.
|
|
1021
|
+
Generate a random, secure password. It is 32 characters long by default and mixes letters, numbers and symbols; the other arguments turn letters, numbers, symbols and spaces on or off.
|
|
1022
1022
|
|
|
1023
1023
|
```javascript
|
|
1024
1024
|
import { password } from "@tolki/str";
|
|
@@ -1026,8 +1026,14 @@ import { password } from "@tolki/str";
|
|
|
1026
1026
|
const result = password();
|
|
1027
1027
|
|
|
1028
1028
|
// result is a random, secure password
|
|
1029
|
+
|
|
1030
|
+
const pin = password(6, false, true, false, false);
|
|
1031
|
+
|
|
1032
|
+
// pin is six random digits
|
|
1029
1033
|
```
|
|
1030
1034
|
|
|
1035
|
+
The password includes at least one character from each set you turn on, if it is long enough to hold one of each. Turning every set off throws an `Error`.
|
|
1036
|
+
|
|
1031
1037
|
#### plural
|
|
1032
1038
|
|
|
1033
1039
|
Get the plural form of an English word.
|
package/dist/str.d.ts
CHANGED
|
@@ -399,17 +399,15 @@ export declare function makePad(padStr: string, needed: number): string;
|
|
|
399
399
|
/**
|
|
400
400
|
* Generate a random, secure password.
|
|
401
401
|
*
|
|
402
|
-
*
|
|
403
|
-
* - Ensures at least one character from each enabled set
|
|
404
|
-
* - Uses a combined pool for remaining characters
|
|
405
|
-
* - Shuffles result and returns a string of requested length
|
|
402
|
+
* Takes one character from each enabled set while the length allows, then fills the rest from every enabled set.
|
|
406
403
|
*
|
|
407
404
|
* @param length The desired length of the password (default: 32)
|
|
408
405
|
* @param letters Whether to include letters (default: true)
|
|
409
406
|
* @param numbers Whether to include numbers (default: true)
|
|
410
407
|
* @param symbols Whether to include symbols (default: true)
|
|
411
408
|
* @param spaces Whether to include spaces (default: false)
|
|
412
|
-
* @
|
|
409
|
+
* @returns The generated password string
|
|
410
|
+
* @throws Error if every character set is turned off.
|
|
413
411
|
*
|
|
414
412
|
* @see https://tolki.abe.dev/strings/string-utilities-list.html#password
|
|
415
413
|
*/
|
package/dist/str.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"str.d.ts","sourceRoot":"","sources":["../src/str.ts"],"names":[],"mappings":"AAqCA;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAatE;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAY1E;AAED;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAQvE;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAY3E;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,EAAE,EAAE,MAAM,GAAG,MAAM,GACpB,MAAM,CAMR;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CACxB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,EAAE,EAAE,MAAM,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nB,KAAK,EAAE,MAAM,EACb,UAAU,GAAE,MAAM,GAAG,MAAM,EAAkB,GAC9C,MAAM,CAcR;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACrB,KAAK,EAAE,MAAM,EACb,UAAU,GAAE,MAAM,GAAG,IAAW,GACjC,MAAM,CAcR;AAwDD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,QAAQ,CACpB,KAAK,EAAE,MAAM,EACb,UAAU,GAAE,MAAW,EACvB,QAAQ,GAAE,MAAa,EACvB,YAAY,GAAE,OAAe,GAC9B,MAAM,CAuGR;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAIjC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAIxC"}
|
package/dist/str.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { isArray as x, toLower as M, isString as S, isFunction as
|
|
2
|
-
import { title as T, upper as
|
|
3
|
-
import { randomInt as U, randomString as
|
|
1
|
+
import { isArray as x, toLower as M, isString as S, isFunction as X, isNumber as Y, isNull as v, isUndefined as tt } from "@tolki/utils";
|
|
2
|
+
import { title as T, upper as H } from "./convertcase/index.js";
|
|
3
|
+
import { randomInt as U, randomString as nt } from "./random/index.js";
|
|
4
4
|
import { substr as $ } from "./replacer/index.js";
|
|
5
|
-
import { ltrim as j, rtrim as G, trim as
|
|
6
|
-
import { createUlidsNormally as
|
|
7
|
-
import { createUuidsNormally as
|
|
5
|
+
import { ltrim as j, rtrim as G, trim as et } from "./trimmer/index.js";
|
|
6
|
+
import { createUlidsNormally as rt } from "./ulid/index.js";
|
|
7
|
+
import { createUuidsNormally as st } from "./uuid/index.js";
|
|
8
8
|
const F = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map();
|
|
9
9
|
let R = null;
|
|
10
|
-
function
|
|
10
|
+
function J(t, n) {
|
|
11
11
|
if (n === "")
|
|
12
12
|
return t;
|
|
13
13
|
const e = String(n), r = t.indexOf(e);
|
|
14
14
|
return r === -1 ? t : t.slice(r + e.length);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function Ct(t, n) {
|
|
17
17
|
if (n === "")
|
|
18
18
|
return t;
|
|
19
19
|
const e = t.lastIndexOf(String(n));
|
|
20
20
|
return e === -1 ? t : t.slice(e + String(n).length);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function ot(t, n) {
|
|
23
23
|
if (n === "")
|
|
24
24
|
return t;
|
|
25
25
|
const e = t.indexOf(String(n));
|
|
26
26
|
return e === -1 ? t : t.slice(0, e);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function it(t, n) {
|
|
29
29
|
if (n === "")
|
|
30
30
|
return t;
|
|
31
31
|
const e = t.lastIndexOf(String(n));
|
|
32
32
|
return e === -1 ? t : $(t, 0, e);
|
|
33
33
|
}
|
|
34
|
-
function Ct(t, n, e) {
|
|
35
|
-
return n === "" || e === "" ? t : ot(H(t, n), e);
|
|
36
|
-
}
|
|
37
34
|
function Rt(t, n, e) {
|
|
38
|
-
return n === "" || e === "" ? t :
|
|
35
|
+
return n === "" || e === "" ? t : it(J(t, n), e);
|
|
36
|
+
}
|
|
37
|
+
function Ft(t, n, e) {
|
|
38
|
+
return n === "" || e === "" ? t : ot(J(t, n), e);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function Nt(t) {
|
|
41
41
|
if (N.has(t))
|
|
42
42
|
return N.get(t);
|
|
43
|
-
const n =
|
|
43
|
+
const n = ht(Q(t));
|
|
44
44
|
return N.set(t, n), n;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function _t(t, n) {
|
|
47
47
|
const e = t.length;
|
|
48
48
|
return (n < 0 ? n < -e : n > e - 1) ? !1 : (n < 0 && (n += e), t.charAt(n));
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function zt(t, n) {
|
|
51
51
|
for (const e of x(n) ? n : [n])
|
|
52
52
|
if (e !== "" && t.startsWith(e)) {
|
|
53
53
|
const r = [...t], s = [...e];
|
|
@@ -55,7 +55,7 @@ function _t(t, n) {
|
|
|
55
55
|
}
|
|
56
56
|
return t;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function Wt(t, n) {
|
|
59
59
|
for (const e of x(n) ? n : [n])
|
|
60
60
|
if (e !== "" && t.endsWith(e)) {
|
|
61
61
|
const r = [...t], s = [...e];
|
|
@@ -63,7 +63,7 @@ function zt(t, n) {
|
|
|
63
63
|
}
|
|
64
64
|
return t;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function Z(t, n, e = !1) {
|
|
67
67
|
e && (t = t.toLowerCase());
|
|
68
68
|
let r;
|
|
69
69
|
typeof n == "string" ? r = [n] : r = Array.from(n);
|
|
@@ -72,28 +72,28 @@ function J(t, n, e = !1) {
|
|
|
72
72
|
return !0;
|
|
73
73
|
return !1;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
const { radius: r = 100, omission: s = "..." } = e, o = String(t ?? ""), i = n ?? "", c = (
|
|
75
|
+
function Ot(t, n = "", e = {}) {
|
|
76
|
+
const { radius: r = 100, omission: s = "..." } = e, o = String(t ?? ""), i = n ?? "", c = (A) => A.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), l = new RegExp(`^(.*?)(${c(i)})(.*)$`, "iu").exec(o);
|
|
77
77
|
if (!l)
|
|
78
78
|
return null;
|
|
79
|
-
const m = String(l[1]), a = String(l[2]),
|
|
80
|
-
let
|
|
81
|
-
|
|
82
|
-
const h = G(
|
|
83
|
-
let
|
|
84
|
-
return
|
|
85
|
-
}
|
|
86
|
-
function
|
|
79
|
+
const m = String(l[1]), a = String(l[2]), p = String(l[3]), g = j(m), u = Array.from(g).length, w = $(g, Math.max(u - r, 0), r);
|
|
80
|
+
let y = j(w);
|
|
81
|
+
y !== g && (y = s + y);
|
|
82
|
+
const h = G(p), d = $(h, 0, r);
|
|
83
|
+
let k = G(d);
|
|
84
|
+
return k !== h && (k = k + s), y + a + k;
|
|
85
|
+
}
|
|
86
|
+
function Mt(t, n, e = !1) {
|
|
87
87
|
let r = !1;
|
|
88
88
|
for (const s of n)
|
|
89
|
-
if (r = !0, !
|
|
89
|
+
if (r = !0, !Z(t, s, e))
|
|
90
90
|
return !1;
|
|
91
91
|
return r;
|
|
92
92
|
}
|
|
93
93
|
function Ut(t, n, e = !1) {
|
|
94
|
-
return !
|
|
94
|
+
return !Z(t, n, e);
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function It(t, n = " ") {
|
|
97
97
|
return x(n) ? (n.forEach((e) => {
|
|
98
98
|
t = t.replace(new RegExp(`${e}+`, "g"), e);
|
|
99
99
|
}), t) : t.replace(new RegExp(`${n}+`, "g"), n);
|
|
@@ -107,20 +107,20 @@ function I(t, n) {
|
|
|
107
107
|
return !0;
|
|
108
108
|
return !1;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function Pt(t, n) {
|
|
111
111
|
return !I(t, n);
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function qt(t, n) {
|
|
114
114
|
const e = n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
115
115
|
return t.replace(new RegExp(`(?:${e})+$`, "u"), "") + n;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function Tt(t, n, e = null) {
|
|
118
118
|
return n + t + (e ?? n);
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function jt(t, n, e = null) {
|
|
121
121
|
return P(t, n) && (t = $(t, z(n))), I(t, e ??= n) && (t = $(t, 0, -z(e))), t;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function Gt(t, n, e = !1) {
|
|
124
124
|
n = String(n);
|
|
125
125
|
let r;
|
|
126
126
|
typeof t == "string" ? r = [t] : r = Array.from(t);
|
|
@@ -134,13 +134,13 @@ function jt(t, n, e = !1) {
|
|
|
134
134
|
}
|
|
135
135
|
return !1;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function ct(t) {
|
|
138
138
|
for (let n = 0; n < t.length; n++)
|
|
139
139
|
if (t.charCodeAt(n) > 127)
|
|
140
140
|
return !1;
|
|
141
141
|
return !0;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function Bt(t) {
|
|
144
144
|
if (!S(t))
|
|
145
145
|
return !1;
|
|
146
146
|
try {
|
|
@@ -150,7 +150,7 @@ function Gt(t) {
|
|
|
150
150
|
}
|
|
151
151
|
return !0;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function Dt(t, n = []) {
|
|
154
154
|
if (!S(t))
|
|
155
155
|
return !1;
|
|
156
156
|
const r = (n.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" : n.join("|")).split("|").map((o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
@@ -180,31 +180,31 @@ function Bt(t, n = []) {
|
|
|
180
180
|
].join("");
|
|
181
181
|
return new RegExp(s, "iu").test(t);
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
return
|
|
183
|
+
function Ht(t) {
|
|
184
|
+
return gt(t, "-");
|
|
185
185
|
}
|
|
186
186
|
function z(t) {
|
|
187
187
|
return t.length;
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function Jt(t, n = 100, e = "...", r = !1) {
|
|
190
190
|
if (t.length <= n)
|
|
191
191
|
return t;
|
|
192
192
|
if (!r)
|
|
193
193
|
return t.slice(0, n).replace(/\s+$/, "") + e;
|
|
194
|
-
t =
|
|
194
|
+
t = mt(t).replace(/[\n\r]+/g, " ").trim();
|
|
195
195
|
const s = t.slice(0, n).replace(/\s+$/, "");
|
|
196
196
|
return t.substring(n, n + 1) === " " ? s + e : s.replace(/(.*)\s.*/, "$1") + e;
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function K(t) {
|
|
199
199
|
return M(t);
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function Zt(t, n = 100, e = "...") {
|
|
202
202
|
if (n <= 0)
|
|
203
203
|
return t;
|
|
204
204
|
const r = n, s = new RegExp(`^\\s*(?:\\S+\\s*){1,${r}}`, "u"), o = t.match(s);
|
|
205
205
|
return !o || z(t) === z(o[0]) ? t : o[0].trimEnd() + e;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function Kt(t, n, e, r = null) {
|
|
208
208
|
if (n === "")
|
|
209
209
|
return t;
|
|
210
210
|
const s = t.length;
|
|
@@ -219,7 +219,7 @@ function Zt(t, n, e, r = null) {
|
|
|
219
219
|
const c = t.slice(0, o), f = i.length, l = t.slice(o + f);
|
|
220
220
|
return c + n.slice(0, 1).repeat(f) + l;
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function Vt(t, n) {
|
|
223
223
|
let e = "u", r = t;
|
|
224
224
|
if (t.length >= 2 && t[0] === "/") {
|
|
225
225
|
let s = -1;
|
|
@@ -248,7 +248,7 @@ function Kt(t, n) {
|
|
|
248
248
|
return "";
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function Qt(t, n) {
|
|
252
252
|
n = String(n);
|
|
253
253
|
const e = typeof t == "string" ? [t] : Array.from(t);
|
|
254
254
|
for (const r of e) {
|
|
@@ -282,7 +282,7 @@ function Vt(t, n) {
|
|
|
282
282
|
}
|
|
283
283
|
return !1;
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function Xt(t, n) {
|
|
286
286
|
let e = "u", r = t;
|
|
287
287
|
if (t.length >= 2 && t[0] === "/") {
|
|
288
288
|
let o = -1;
|
|
@@ -316,24 +316,24 @@ function Qt(t, n) {
|
|
|
316
316
|
}
|
|
317
317
|
return s;
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function Yt(t) {
|
|
320
320
|
return x(t) ? t.map((n) => n.replace(/\D/g, "")) : t.replace(/\D/g, "");
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function vt(t, n, e = " ") {
|
|
323
323
|
const r = t.length;
|
|
324
324
|
if (n <= r || e === "")
|
|
325
325
|
return t;
|
|
326
326
|
const s = n - r, o = Math.floor(s / 2), i = s - o;
|
|
327
327
|
return W(e, o) + t + W(e, i);
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function tn(t, n, e = " ") {
|
|
330
330
|
const r = t.length;
|
|
331
331
|
if (n <= r || e === "")
|
|
332
332
|
return t;
|
|
333
333
|
const o = n - r;
|
|
334
334
|
return W(e, o) + t;
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function nn(t, n, e = " ") {
|
|
337
337
|
const r = t.length;
|
|
338
338
|
if (n <= r || e === "")
|
|
339
339
|
return t;
|
|
@@ -346,7 +346,7 @@ function W(t, n) {
|
|
|
346
346
|
const e = Math.ceil(n / t.length);
|
|
347
347
|
return t.repeat(e).slice(0, n);
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function en(t = 32, n = !0, e = !0, r = !0, s = !1) {
|
|
350
350
|
const l = [
|
|
351
351
|
n ? [
|
|
352
352
|
"a",
|
|
@@ -432,26 +432,24 @@ function nn(t = 32, n = !0, e = !0, r = !0, s = !1) {
|
|
|
432
432
|
";"
|
|
433
433
|
] : null,
|
|
434
434
|
s ? [" "] : null
|
|
435
|
-
].filter((
|
|
436
|
-
if (l.length === 0
|
|
437
|
-
|
|
438
|
-
const m = []
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
const u = U(0, p), y = m[p];
|
|
450
|
-
m[p] = m[u], m[u] = y;
|
|
435
|
+
].filter((g) => x(g));
|
|
436
|
+
if (l.length === 0)
|
|
437
|
+
throw new Error("At least one character pool must be enabled.");
|
|
438
|
+
const m = l.flat(), a = B(l).slice(0, Math.max(0, t)).map((g) => g[U(0, g.length - 1)]), p = Array.from(
|
|
439
|
+
{ length: Math.max(0, t - a.length) },
|
|
440
|
+
() => m[U(0, m.length - 1)]
|
|
441
|
+
);
|
|
442
|
+
return B([...a, ...p]).join("");
|
|
443
|
+
}
|
|
444
|
+
function B(t) {
|
|
445
|
+
const n = [...t];
|
|
446
|
+
for (let e = n.length - 1; e > 0; e--) {
|
|
447
|
+
const r = U(0, e);
|
|
448
|
+
[n[e], n[r]] = [n[r], n[e]];
|
|
451
449
|
}
|
|
452
|
-
return
|
|
450
|
+
return n;
|
|
453
451
|
}
|
|
454
|
-
function
|
|
452
|
+
function rn(t, n, e = 0) {
|
|
455
453
|
if (n === "")
|
|
456
454
|
return !1;
|
|
457
455
|
const r = Array.from(t), s = Array.from(n);
|
|
@@ -471,29 +469,29 @@ function en(t, n, e = 0) {
|
|
|
471
469
|
}
|
|
472
470
|
return !1;
|
|
473
471
|
}
|
|
474
|
-
function
|
|
475
|
-
return (R ?? ((e) =>
|
|
472
|
+
function lt(t = 16) {
|
|
473
|
+
return (R ?? ((e) => nt(e)))(t);
|
|
476
474
|
}
|
|
477
|
-
function
|
|
475
|
+
function ft(t) {
|
|
478
476
|
R = t;
|
|
479
477
|
}
|
|
480
|
-
function
|
|
478
|
+
function sn(t, n) {
|
|
481
479
|
let e = 0;
|
|
482
480
|
const r = n ?? function(s) {
|
|
483
481
|
const o = R;
|
|
484
482
|
R = null;
|
|
485
|
-
const i =
|
|
483
|
+
const i = lt(s);
|
|
486
484
|
return R = o, e++, i;
|
|
487
485
|
};
|
|
488
|
-
|
|
486
|
+
ft((s) => e < t.length ? String(t[e++]) : r(s));
|
|
489
487
|
}
|
|
490
|
-
function
|
|
488
|
+
function at() {
|
|
491
489
|
R = null;
|
|
492
490
|
}
|
|
493
|
-
function
|
|
491
|
+
function on(t, n) {
|
|
494
492
|
return n <= 0 ? "" : t.repeat(n);
|
|
495
493
|
}
|
|
496
|
-
function
|
|
494
|
+
function cn(t, n, e) {
|
|
497
495
|
let r;
|
|
498
496
|
typeof n == "object" && !x(n) ? r = Object.values(n) : r = x(n) ? [...n] : Array.from(n);
|
|
499
497
|
const s = e.split(t);
|
|
@@ -506,7 +504,7 @@ function on(t, n, e) {
|
|
|
506
504
|
}
|
|
507
505
|
return String(o);
|
|
508
506
|
}
|
|
509
|
-
function
|
|
507
|
+
function ln(t, n) {
|
|
510
508
|
try {
|
|
511
509
|
const e = String(t);
|
|
512
510
|
if (e.length)
|
|
@@ -516,55 +514,55 @@ function cn(t, n) {
|
|
|
516
514
|
return n;
|
|
517
515
|
}
|
|
518
516
|
}
|
|
519
|
-
function
|
|
517
|
+
function fn(t, n, e, r = !0) {
|
|
520
518
|
if (S(t) && !S(n))
|
|
521
519
|
throw new TypeError(
|
|
522
520
|
"The replacement must be a string when the search term is a string."
|
|
523
521
|
);
|
|
524
|
-
const s = S(e) ? e : Array.from(e, (f) =>
|
|
522
|
+
const s = S(e) ? e : Array.from(e, (f) => E(f));
|
|
525
523
|
if (!r)
|
|
526
|
-
return
|
|
524
|
+
return V(
|
|
527
525
|
t,
|
|
528
526
|
n,
|
|
529
527
|
s
|
|
530
528
|
);
|
|
531
|
-
const o = S(t) ? [t] : Array.from(t, (f) =>
|
|
529
|
+
const o = S(t) ? [t] : Array.from(t, (f) => E(f)), i = S(n) ? o.map(() => n) : Array.from(n, (f) => E(f)), c = (f) => o.reduce((l, m, a) => m === "" ? l : l.split(m).join(i[a] ?? ""), f);
|
|
532
530
|
return S(s) ? c(s) : s.map(c);
|
|
533
531
|
}
|
|
534
|
-
function
|
|
535
|
-
const r = S(t) ? [t] : Array.from(t, (c) =>
|
|
532
|
+
function V(t, n, e) {
|
|
533
|
+
const r = S(t) ? [t] : Array.from(t, (c) => E(c)), s = S(n) ? r.map(() => n) : Array.from(n, (c) => E(c)), o = (c) => c.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), i = (c) => r.reduce((f, l, m) => {
|
|
536
534
|
if (l === "")
|
|
537
535
|
return f;
|
|
538
|
-
const a = s[m] ?? "",
|
|
536
|
+
const a = s[m] ?? "", p = new RegExp(
|
|
539
537
|
o(l),
|
|
540
|
-
|
|
538
|
+
ct(l) ? "gi" : "giu"
|
|
541
539
|
);
|
|
542
|
-
return f.replace(
|
|
540
|
+
return f.replace(p, () => a);
|
|
543
541
|
}, c);
|
|
544
542
|
return S(e) ? i(e) : e.map(i);
|
|
545
543
|
}
|
|
546
|
-
function
|
|
547
|
-
return
|
|
544
|
+
function E(t) {
|
|
545
|
+
return v(t) || tt(t) ? "" : String(t);
|
|
548
546
|
}
|
|
549
|
-
function
|
|
547
|
+
function ut(t, n, e) {
|
|
550
548
|
if (t = String(t), t === "")
|
|
551
549
|
return e;
|
|
552
550
|
const r = e.indexOf(t);
|
|
553
551
|
return r !== -1 ? e.slice(0, r) + n + e.slice(r + t.length) : e;
|
|
554
552
|
}
|
|
555
|
-
function
|
|
556
|
-
return t = String(t), t === "" ? e : P(e, t) ?
|
|
553
|
+
function an(t, n, e) {
|
|
554
|
+
return t = String(t), t === "" ? e : P(e, t) ? ut(t, n, e) : e;
|
|
557
555
|
}
|
|
558
|
-
function
|
|
556
|
+
function pt(t, n, e) {
|
|
559
557
|
if (t = String(t), t === "")
|
|
560
558
|
return e;
|
|
561
559
|
const r = e.lastIndexOf(t);
|
|
562
560
|
return r !== -1 ? e.slice(0, r) + n + e.slice(r + t.length) : e;
|
|
563
561
|
}
|
|
564
|
-
function
|
|
565
|
-
return t = String(t), t === "" ? e : I(e, t) ?
|
|
562
|
+
function un(t, n, e) {
|
|
563
|
+
return t = String(t), t === "" ? e : I(e, t) ? pt(t, n, e) : e;
|
|
566
564
|
}
|
|
567
|
-
function
|
|
565
|
+
function pn(t, n, e, r = -1) {
|
|
568
566
|
const s = (a) => x(a) ? a : [a], o = s(t);
|
|
569
567
|
function i(a) {
|
|
570
568
|
try {
|
|
@@ -572,30 +570,30 @@ function un(t, n, e, r = -1) {
|
|
|
572
570
|
let u = a.flags;
|
|
573
571
|
return u.includes("g") || (u += "g"), u.includes("u") || (u += "u"), new RegExp(a.source, u);
|
|
574
572
|
}
|
|
575
|
-
let
|
|
573
|
+
let p = a, g = "gu";
|
|
576
574
|
if (a.length >= 2 && a[0] === "/") {
|
|
577
575
|
let u = -1;
|
|
578
|
-
for (let
|
|
579
|
-
if (a[
|
|
580
|
-
let
|
|
581
|
-
for (let h =
|
|
582
|
-
|
|
583
|
-
if (
|
|
584
|
-
u =
|
|
576
|
+
for (let w = a.length - 1; w > 0; w--)
|
|
577
|
+
if (a[w] === "/") {
|
|
578
|
+
let y = 0;
|
|
579
|
+
for (let h = w - 1; h >= 0 && a[h] === "\\"; h--)
|
|
580
|
+
y++;
|
|
581
|
+
if (y % 2 === 0) {
|
|
582
|
+
u = w;
|
|
585
583
|
break;
|
|
586
584
|
}
|
|
587
585
|
}
|
|
588
586
|
if (u > 1) {
|
|
589
|
-
|
|
590
|
-
const
|
|
591
|
-
if (
|
|
592
|
-
for (const
|
|
593
|
-
/[imsuy]/.test(
|
|
587
|
+
p = a.slice(1, u);
|
|
588
|
+
const w = a.slice(u + 1);
|
|
589
|
+
if (w)
|
|
590
|
+
for (const y of w)
|
|
591
|
+
/[imsuy]/.test(y) && !g.includes(y) && (g += y);
|
|
594
592
|
}
|
|
595
593
|
}
|
|
596
594
|
return new RegExp(
|
|
597
|
-
|
|
598
|
-
Array.from(new Set(
|
|
595
|
+
p,
|
|
596
|
+
Array.from(new Set(g.split(""))).join("")
|
|
599
597
|
);
|
|
600
598
|
} catch {
|
|
601
599
|
return null;
|
|
@@ -603,58 +601,58 @@ function un(t, n, e, r = -1) {
|
|
|
603
601
|
}
|
|
604
602
|
const c = [];
|
|
605
603
|
for (const a of o) {
|
|
606
|
-
const
|
|
607
|
-
if (!
|
|
608
|
-
c.push(
|
|
604
|
+
const p = i(a);
|
|
605
|
+
if (!p) return null;
|
|
606
|
+
c.push(p);
|
|
609
607
|
}
|
|
610
|
-
const f =
|
|
611
|
-
let
|
|
612
|
-
for (let
|
|
613
|
-
const u = c[
|
|
608
|
+
const f = X(n), l = f ? [] : s(n), m = (a) => {
|
|
609
|
+
let p = a;
|
|
610
|
+
for (let g = 0; g < c.length; g++) {
|
|
611
|
+
const u = c[g];
|
|
614
612
|
if (f) {
|
|
615
|
-
let
|
|
616
|
-
const
|
|
617
|
-
|
|
613
|
+
let w = 0;
|
|
614
|
+
const y = n;
|
|
615
|
+
p = p.replace(
|
|
618
616
|
u,
|
|
619
617
|
(h, ...d) => {
|
|
620
|
-
if (r >= 0 &&
|
|
621
|
-
|
|
622
|
-
const
|
|
623
|
-
for (let b = 0; b <
|
|
624
|
-
|
|
625
|
-
const C = [h, ...
|
|
626
|
-
return
|
|
618
|
+
if (r >= 0 && w >= r) return h;
|
|
619
|
+
w++;
|
|
620
|
+
const L = d.length > 0 && d[d.length - 1] !== null && typeof d[d.length - 1] == "object" ? d.length - 3 : d.length - 2, A = [];
|
|
621
|
+
for (let b = 0; b < L; b++)
|
|
622
|
+
A.push(d[b]);
|
|
623
|
+
const C = [h, ...A];
|
|
624
|
+
return y(C);
|
|
627
625
|
}
|
|
628
626
|
);
|
|
629
627
|
} else {
|
|
630
|
-
const
|
|
628
|
+
const w = l[g] ?? (l.length === 1 ? l[0] : "");
|
|
631
629
|
if (r < 0)
|
|
632
|
-
|
|
633
|
-
const
|
|
634
|
-
return
|
|
630
|
+
p = p.replace(u, (y, ...h) => {
|
|
631
|
+
const k = h.length > 0 && h[h.length - 1] !== null && typeof h[h.length - 1] == "object" ? h.length - 3 : h.length - 2, L = h.slice(0, k).map((A) => String(A));
|
|
632
|
+
return w.replace(/\$(\d{1,2})/g, (A, C) => {
|
|
635
633
|
const b = parseInt(C, 10);
|
|
636
|
-
return (
|
|
634
|
+
return (L[b - 1] ?? "").toUpperCase();
|
|
637
635
|
});
|
|
638
636
|
});
|
|
639
637
|
else {
|
|
640
|
-
let
|
|
641
|
-
|
|
642
|
-
if (
|
|
643
|
-
|
|
644
|
-
const
|
|
645
|
-
return
|
|
638
|
+
let y = 0;
|
|
639
|
+
p = p.replace(u, (h, ...d) => {
|
|
640
|
+
if (y >= r) return h;
|
|
641
|
+
y++;
|
|
642
|
+
const L = d.length > 0 && d[d.length - 1] !== null && typeof d[d.length - 1] == "object" ? d.length - 3 : d.length - 2, A = d.slice(0, L).map((C) => String(C));
|
|
643
|
+
return w.replace(/\$(\d{1,2})/g, (C, b) => {
|
|
646
644
|
const q = parseInt(b, 10);
|
|
647
|
-
return (
|
|
645
|
+
return (A[q - 1] ?? "").toUpperCase();
|
|
648
646
|
});
|
|
649
647
|
});
|
|
650
648
|
}
|
|
651
649
|
}
|
|
652
650
|
}
|
|
653
|
-
return
|
|
651
|
+
return p;
|
|
654
652
|
};
|
|
655
653
|
return x(e) ? e.map(m) : m(e);
|
|
656
654
|
}
|
|
657
|
-
function
|
|
655
|
+
function mt(t) {
|
|
658
656
|
let n = "", e = !1;
|
|
659
657
|
for (let r = 0; r < t.length; r++) {
|
|
660
658
|
const s = t[r];
|
|
@@ -662,11 +660,11 @@ function pt(t) {
|
|
|
662
660
|
}
|
|
663
661
|
return n;
|
|
664
662
|
}
|
|
665
|
-
function
|
|
666
|
-
const r = S(n) ? n : Array.from(n, (i) =>
|
|
663
|
+
function mn(t, n, e = !0) {
|
|
664
|
+
const r = S(n) ? n : Array.from(n, (i) => E(i));
|
|
667
665
|
if (!e)
|
|
668
|
-
return
|
|
669
|
-
const s = S(t) ? [t] : Array.from(t, (i) =>
|
|
666
|
+
return V(t, "", r);
|
|
667
|
+
const s = S(t) ? [t] : Array.from(t, (i) => E(i)), o = (i) => {
|
|
670
668
|
let c = i;
|
|
671
669
|
for (const f of s)
|
|
672
670
|
f !== "" && (c = c.split(f).join(""));
|
|
@@ -674,25 +672,25 @@ function pn(t, n, e = !0) {
|
|
|
674
672
|
};
|
|
675
673
|
return S(r) ? o(r) : r.map(o);
|
|
676
674
|
}
|
|
677
|
-
function
|
|
675
|
+
function gn(t) {
|
|
678
676
|
return Array.from(t).reverse().join("");
|
|
679
677
|
}
|
|
680
|
-
function
|
|
678
|
+
function hn(t, n) {
|
|
681
679
|
const e = n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
682
680
|
return n + t.replace(new RegExp(`^(?:${e})+`, "u"), "");
|
|
683
681
|
}
|
|
684
|
-
function
|
|
682
|
+
function dn(t) {
|
|
685
683
|
const n = String(t).trim();
|
|
686
684
|
if (n === "")
|
|
687
685
|
return "";
|
|
688
686
|
let e = n.split(/\s+/u);
|
|
689
|
-
return e.length > 1 ? e = e.map((s) => T(s)) : e =
|
|
687
|
+
return e.length > 1 ? e = e.map((s) => T(s)) : e = dt(e.join("_")).map((s) => T(s)), e.join("_").replace(/[-_ ]+/gu, "_").split("_").filter((s) => s.length > 0).join(" ");
|
|
690
688
|
}
|
|
691
|
-
function
|
|
689
|
+
function yn(t, n = !1) {
|
|
692
690
|
const r = t.split(/\s+/u).filter((s) => s.length > 0).map((s) => [...s][0]).join("");
|
|
693
|
-
return n ?
|
|
691
|
+
return n ? H(r) : r;
|
|
694
692
|
}
|
|
695
|
-
function
|
|
693
|
+
function wn(t) {
|
|
696
694
|
if (t.trim() === "")
|
|
697
695
|
return t;
|
|
698
696
|
const n = /* @__PURE__ */ new Set([
|
|
@@ -748,21 +746,21 @@ function yn(t) {
|
|
|
748
746
|
}
|
|
749
747
|
return r.join(" ");
|
|
750
748
|
}
|
|
751
|
-
function
|
|
749
|
+
function gt(t, n = "_") {
|
|
752
750
|
const r = `${t}|${n}`;
|
|
753
751
|
if (F.has(r))
|
|
754
752
|
return F.get(r);
|
|
755
753
|
let s = t;
|
|
756
|
-
return /^[a-z]+$/.test(t) || (s =
|
|
754
|
+
return /^[a-z]+$/.test(t) || (s = yt(t).replace(/\s+/gu, ""), s = s.replace(/(.)(?=[A-Z])/g, `$1${n}`), s = K(s)), F.set(r, s), s;
|
|
757
755
|
}
|
|
758
|
-
function
|
|
759
|
-
return
|
|
756
|
+
function Sn(t) {
|
|
757
|
+
return et(t).replace(/[\s\u3164\u1160]+/gu, " ");
|
|
760
758
|
}
|
|
761
759
|
function P(t, n) {
|
|
762
760
|
if (t == null || n == null)
|
|
763
761
|
return !1;
|
|
764
762
|
let e;
|
|
765
|
-
S(n) ||
|
|
763
|
+
S(n) || Y(n) ? e = [n] : Symbol.iterator in Object(n) ? e = Array.from(n) : e = [n];
|
|
766
764
|
const r = String(t);
|
|
767
765
|
for (const s of e) {
|
|
768
766
|
if (s == null)
|
|
@@ -773,10 +771,10 @@ function P(t, n) {
|
|
|
773
771
|
}
|
|
774
772
|
return !1;
|
|
775
773
|
}
|
|
776
|
-
function
|
|
774
|
+
function xn(t, n) {
|
|
777
775
|
return !P(t, n);
|
|
778
776
|
}
|
|
779
|
-
function
|
|
777
|
+
function Q(t, n = !1) {
|
|
780
778
|
let e = t;
|
|
781
779
|
n && (e = t.replace(
|
|
782
780
|
/(^|[-_ \s])([A-Z]+)(?=[-_ \s]|$)/gu,
|
|
@@ -792,10 +790,10 @@ function V(t, n = !1) {
|
|
|
792
790
|
}, c = o.map(i).join("");
|
|
793
791
|
return _.set(r, c), c;
|
|
794
792
|
}
|
|
795
|
-
function
|
|
796
|
-
return
|
|
793
|
+
function $n(t, n = !1) {
|
|
794
|
+
return Q(t, n);
|
|
797
795
|
}
|
|
798
|
-
function
|
|
796
|
+
function An(t, n) {
|
|
799
797
|
if (!t || Object.keys(t).length === 0)
|
|
800
798
|
return n;
|
|
801
799
|
const e = Object.keys(t).filter((o) => o !== "");
|
|
@@ -808,34 +806,34 @@ function $n(t, n) {
|
|
|
808
806
|
function kn(t, n) {
|
|
809
807
|
return n < 0 ? $(t, n) : $(t, 0, n);
|
|
810
808
|
}
|
|
811
|
-
function
|
|
812
|
-
return
|
|
809
|
+
function ht(t) {
|
|
810
|
+
return K($(t, 0, 1)) + $(t, 1);
|
|
813
811
|
}
|
|
814
|
-
function
|
|
815
|
-
return
|
|
812
|
+
function bn(t) {
|
|
813
|
+
return H($(t, 0, 1)) + $(t, 1);
|
|
816
814
|
}
|
|
817
|
-
function
|
|
815
|
+
function dt(t) {
|
|
818
816
|
return t.split(new RegExp("(?=\\p{Lu})", "u")).filter(Boolean);
|
|
819
817
|
}
|
|
820
|
-
function
|
|
818
|
+
function yt(t, n = ` \r
|
|
821
819
|
\f\v`) {
|
|
822
820
|
const e = x(n) ? n.join("") : n, r = (c) => c.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"), s = e.length ? r(e) : "", o = s.length ? `(?:\\s|[${s}])` : "\\s", i = new RegExp(`(^|${o})(\\p{Ll})`, "gu");
|
|
823
821
|
return t.replace(i, (c, f, l) => f + l.toUpperCase());
|
|
824
822
|
}
|
|
825
|
-
function
|
|
823
|
+
function En(t, n = null) {
|
|
826
824
|
const e = n && n.length > 0 ? n.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&") : "", r = e.length > 0 ? new RegExp(`[\\p{L}\\p{N}${e}]+`, "gu") : /[\p{L}\p{N}]+/gu, s = t.match(r);
|
|
827
825
|
return s ? s.length : 0;
|
|
828
826
|
}
|
|
829
827
|
function O(t) {
|
|
830
828
|
return t.trim() === "";
|
|
831
829
|
}
|
|
832
|
-
function
|
|
830
|
+
function D(t, n, e) {
|
|
833
831
|
let r = n;
|
|
834
832
|
for (; r < e && O(t[r]); )
|
|
835
833
|
r++;
|
|
836
834
|
return r;
|
|
837
835
|
}
|
|
838
|
-
function
|
|
836
|
+
function wt(t, n, e) {
|
|
839
837
|
let r = e;
|
|
840
838
|
for (; r > n && O(t[r - 1]); )
|
|
841
839
|
r--;
|
|
@@ -854,12 +852,12 @@ function Ln(t, n = 75, e = `
|
|
|
854
852
|
}
|
|
855
853
|
let l = 0;
|
|
856
854
|
if (r) {
|
|
857
|
-
for (; l < f && (l =
|
|
855
|
+
for (; l < f && (l = D(c, l, f), l !== f); ) {
|
|
858
856
|
if (f - l <= n) {
|
|
859
857
|
o.push(c.slice(l, f).join(""));
|
|
860
858
|
break;
|
|
861
859
|
}
|
|
862
|
-
const m =
|
|
860
|
+
const m = wt(
|
|
863
861
|
c,
|
|
864
862
|
l,
|
|
865
863
|
l + n
|
|
@@ -869,28 +867,28 @@ function Ln(t, n = 75, e = `
|
|
|
869
867
|
continue;
|
|
870
868
|
}
|
|
871
869
|
for (; f - l > n; ) {
|
|
872
|
-
const m =
|
|
870
|
+
const m = D(c, l, f);
|
|
873
871
|
if (m !== l && (l = m, f - l <= n))
|
|
874
872
|
break;
|
|
875
873
|
const a = Math.min(f, l + n + 1);
|
|
876
|
-
let
|
|
874
|
+
let p = -1;
|
|
877
875
|
for (let u = a - 1; u >= l; u--)
|
|
878
876
|
if (O(c[u])) {
|
|
879
|
-
|
|
877
|
+
p = u;
|
|
880
878
|
break;
|
|
881
879
|
}
|
|
882
|
-
if (
|
|
883
|
-
o.push(c.slice(l,
|
|
880
|
+
if (p > l) {
|
|
881
|
+
o.push(c.slice(l, p).join("")), l = p + 1;
|
|
884
882
|
continue;
|
|
885
883
|
}
|
|
886
|
-
let
|
|
884
|
+
let g = -1;
|
|
887
885
|
for (let u = l; u < f; u++)
|
|
888
886
|
if (O(c[u])) {
|
|
889
|
-
|
|
887
|
+
g = u;
|
|
890
888
|
break;
|
|
891
889
|
}
|
|
892
|
-
if (
|
|
893
|
-
o.push(c.slice(l,
|
|
890
|
+
if (g >= 0) {
|
|
891
|
+
o.push(c.slice(l, g).join("")), l = g + 1;
|
|
894
892
|
continue;
|
|
895
893
|
}
|
|
896
894
|
o.push(c.slice(l, f).join("")), l = f;
|
|
@@ -900,99 +898,99 @@ function Ln(t, n = 75, e = `
|
|
|
900
898
|
}
|
|
901
899
|
return o.join(e);
|
|
902
900
|
}
|
|
903
|
-
function
|
|
901
|
+
function Cn() {
|
|
904
902
|
return F.size;
|
|
905
903
|
}
|
|
906
|
-
function
|
|
904
|
+
function Rn() {
|
|
907
905
|
return N.size;
|
|
908
906
|
}
|
|
909
|
-
function
|
|
907
|
+
function Fn() {
|
|
910
908
|
return _.size;
|
|
911
909
|
}
|
|
912
|
-
function
|
|
910
|
+
function Nn() {
|
|
913
911
|
F.clear(), N.clear(), _.clear();
|
|
914
912
|
}
|
|
915
|
-
function
|
|
916
|
-
|
|
913
|
+
function _n() {
|
|
914
|
+
at(), rt(), st();
|
|
917
915
|
}
|
|
918
916
|
export {
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
917
|
+
J as after,
|
|
918
|
+
Ct as afterLast,
|
|
919
|
+
wn as apa,
|
|
920
|
+
ot as before,
|
|
921
|
+
it as beforeLast,
|
|
922
|
+
Rt as between,
|
|
923
|
+
Ft as betweenFirst,
|
|
924
|
+
Nt as camel,
|
|
925
|
+
Rn as camelCacheSize,
|
|
926
|
+
_t as charAt,
|
|
927
|
+
Wt as chopEnd,
|
|
928
|
+
zt as chopStart,
|
|
929
|
+
Z as contains,
|
|
930
|
+
Mt as containsAll,
|
|
931
|
+
at as createRandomStringsNormally,
|
|
932
|
+
ft as createRandomStringsUsing,
|
|
933
|
+
sn as createRandomStringsUsingSequence,
|
|
934
|
+
It as deduplicate,
|
|
937
935
|
Ut as doesntContain,
|
|
938
|
-
|
|
939
|
-
|
|
936
|
+
Pt as doesntEndWith,
|
|
937
|
+
xn as doesntStartWith,
|
|
940
938
|
I as endsWith,
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
939
|
+
Ot as excerpt,
|
|
940
|
+
qt as finish,
|
|
941
|
+
Nn as flushCache,
|
|
942
|
+
dn as headline,
|
|
943
|
+
yn as initials,
|
|
944
|
+
Gt as is,
|
|
945
|
+
ct as isAscii,
|
|
946
|
+
Bt as isJson,
|
|
947
|
+
Qt as isMatch,
|
|
948
|
+
Dt as isUrl,
|
|
949
|
+
Ht as kebab,
|
|
950
|
+
ht as lcfirst,
|
|
953
951
|
z as length,
|
|
954
|
-
|
|
955
|
-
|
|
952
|
+
Jt as limit,
|
|
953
|
+
K as lower,
|
|
956
954
|
W as makePad,
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
955
|
+
Kt as mask,
|
|
956
|
+
Vt as match,
|
|
957
|
+
Xt as matchAll,
|
|
958
|
+
Yt as numbers,
|
|
959
|
+
vt as padBoth,
|
|
960
|
+
tn as padLeft,
|
|
961
|
+
nn as padRight,
|
|
962
|
+
$n as pascal,
|
|
963
|
+
en as password,
|
|
964
|
+
rn as position,
|
|
965
|
+
lt as random,
|
|
966
|
+
mn as remove,
|
|
967
|
+
on as repeat,
|
|
968
|
+
fn as replace,
|
|
969
|
+
cn as replaceArray,
|
|
970
|
+
un as replaceEnd,
|
|
971
|
+
ut as replaceFirst,
|
|
972
|
+
pt as replaceLast,
|
|
973
|
+
pn as replaceMatches,
|
|
974
|
+
an as replaceStart,
|
|
975
|
+
_n as resetFactoryState,
|
|
976
|
+
gn as reverse,
|
|
977
|
+
gt as snake,
|
|
978
|
+
Cn as snakeCacheSize,
|
|
979
|
+
Sn as squish,
|
|
980
|
+
hn as start,
|
|
983
981
|
P as startsWith,
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
982
|
+
mt as stripTags,
|
|
983
|
+
Q as studly,
|
|
984
|
+
Fn as studlyCacheSize,
|
|
985
|
+
An as swap,
|
|
988
986
|
kn as take,
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
987
|
+
ln as toStringOr,
|
|
988
|
+
bn as ucfirst,
|
|
989
|
+
dt as ucsplit,
|
|
990
|
+
yt as ucwords,
|
|
991
|
+
jt as unwrap,
|
|
992
|
+
En as wordCount,
|
|
995
993
|
Ln as wordWrap,
|
|
996
|
-
|
|
997
|
-
|
|
994
|
+
Zt as words,
|
|
995
|
+
Tt as wrap
|
|
998
996
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tolki/str",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Utilities for working with strings similar to Laravel's Str & Stringable classes.",
|
|
5
5
|
"author": "Abraham Arango <https://github.com/abetwothree>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"transliteration": "^2.6.0",
|
|
37
37
|
"ulid": "^2.4.0",
|
|
38
38
|
"uuid": "^11.1.0",
|
|
39
|
-
"@tolki/
|
|
40
|
-
"@tolki/
|
|
39
|
+
"@tolki/utils": "^1.4.0",
|
|
40
|
+
"@tolki/num": "^2.2.3"
|
|
41
41
|
},
|
|
42
42
|
"files": [
|
|
43
43
|
"dist"
|