@tolki/str 1.7.1 → 1.8.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 CHANGED
@@ -1182,6 +1182,16 @@ const result = remove(
1182
1182
  // result is "Ptr Pipr pickd a pck of pickld ppprs."
1183
1183
  ```
1184
1184
 
1185
+ The subject can also be a list, an object or a `Map` of strings, and the result keeps its shape and keys. A collection gives back what its `all()` holds, and any other iterable gives a list:
1186
+
1187
+ ```javascript
1188
+ import { remove } from "@tolki/str";
1189
+
1190
+ const result = remove("o", { first: "Foo", last: "Boo" });
1191
+
1192
+ // result is { first: "F", last: "B" }
1193
+ ```
1194
+
1185
1195
  #### repeat
1186
1196
 
1187
1197
  Repeat the given string.
@@ -1221,6 +1231,16 @@ const result = replace(
1221
1231
  // result is "Laravel Framework for Web Artisans"
1222
1232
  ```
1223
1233
 
1234
+ The subject can also be a list, an object or a `Map` of strings, and the result keeps its shape and keys. A collection gives back what its `all()` holds, and any other iterable gives a list:
1235
+
1236
+ ```javascript
1237
+ import { replace } from "@tolki/str";
1238
+
1239
+ const result = replace("o", "0", { first: "Foo", last: "Boo" });
1240
+
1241
+ // result is { first: "F00", last: "B00" }
1242
+ ```
1243
+
1224
1244
  #### replaceArray
1225
1245
 
1226
1246
  Replace a given value in the string sequentially with an array.
@@ -1486,6 +1506,8 @@ const result = substrCount(
1486
1506
  // result is 2
1487
1507
  ```
1488
1508
 
1509
+ Offsets and lengths count characters, so an emoji counts as one. An empty needle throws, as it does in PHP. <!-- docs/php-parity/Str/substrCount.json, "substrCount-laravel-multibyte", "substrCount-empty-needle" -->
1510
+
1489
1511
  #### substrReplace
1490
1512
 
1491
1513
  Replace text within a portion of a string.
package/dist/index.d.ts CHANGED
@@ -11,4 +11,5 @@ export * from './transliterate';
11
11
  export * from './trimmer';
12
12
  export * from './ulid';
13
13
  export * from './uuid';
14
+ export type { StringSubject, StringSubjectResult } from '@tolki/types';
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
@@ -17,6 +17,7 @@ export declare function substr(string: string, start: number, length?: number |
17
17
  * @param offset - The starting position for the search. If negative, it starts that many characters from the end of the string.
18
18
  * @param length - The length of the segment to search within. If omitted or null, searches to the end of the string. If negative, omits that many characters from the end.
19
19
  * @returns The number of occurrences of the substring within the specified segment.
20
+ * @throws Error for an empty needle, as PHP's substr_count() throws its ValueError
20
21
  *
21
22
  * @see https://tolki.abe.dev/strings/string-utilities-list.html#substrcount
22
23
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/replacer/index.ts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AAa,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACjE,MAAM,EAAE,QAAQ,EAChB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnD,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,GAClC,MAAM,CAAC,MAAM,QAAQ,EAAE,MAAM,CAAC,CAAC;AAClC,wBAAgB,aAAa,CACzB,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAClD,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnD,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,GAClC,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC"}
@@ -5,7 +5,7 @@ function r(e, t, n = null) {
5
5
  return a >= i || o <= a ? "" : r.slice(a, o).join("");
6
6
  }
7
7
  function i(e, t, n = 0, r = null) {
8
- if (t === "") return 0;
8
+ if (t === "") throw Error("substr_count(): Argument #2 ($needle) must not be empty");
9
9
  let i = Array.from(e), a = i.length, { start: o, end: l } = s(a, n, r);
10
10
  return o >= a || l <= o ? 0 : c(i.slice(o, l).join(""), t);
11
11
  }
package/dist/str.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { StringSubject, StringSubjectResult } from '@tolki/types';
1
2
  /**
2
3
  * Return the remainder of a string after the first occurrence of a given value.
3
4
  *
@@ -504,14 +505,15 @@ export declare function toStringOr(value: unknown, fallback: string): string;
504
505
  *
505
506
  * @param search - The value or values to search for
506
507
  * @param replacement - The value or values to replace with
507
- * @param subject - The string or array of strings to perform replacements on
508
+ * @param subject - The string, or the strings in a list, object, Map, collection or iterable
508
509
  * @param caseSensitive - Whether the search should be case-sensitive (default: true)
509
- * @returns The resulting string or array of strings after replacements
510
+ * @returns The resulting string, or the strings in the subject's shape: a list for a list or iterable, an object for an
511
+ * object, a Map for a Map, and what all() holds for a collection
510
512
  * @throws TypeError when the search term is a string but the replacement is a list, mirroring PHP's str_replace
511
513
  *
512
514
  * @see https://tolki.abe.dev/strings/string-utilities-list.html#replace
513
515
  */
514
- export declare function replace<T extends string | Iterable<string>>(search: string | Iterable<string>, replacement: string | Iterable<string>, subject: T, caseSensitive?: boolean): T extends string ? string : string[];
516
+ export declare function replace<TSubject extends StringSubject<TSubject>>(search: string | Iterable<string>, replacement: string | Iterable<string>, subject: TSubject, caseSensitive?: boolean): StringSubjectResult<TSubject>;
515
517
  /**
516
518
  * Replace the first occurrence of a given value in the string.
517
519
  *
@@ -587,15 +589,14 @@ export declare function stripTags(value: string): string;
587
589
  * mirroring Laravel's behavior.
588
590
  *
589
591
  * @param search - The string or strings to remove
590
- * @param subject - The string or strings to process
592
+ * @param subject - The string, or the strings in a list, object, Map, collection or iterable
591
593
  * @param caseSensitive - Whether the search should be case-sensitive (default: true)
592
- * @returns The resulting string or array of strings after removal
594
+ * @returns The resulting string, or the strings in the subject's shape: a list for a list or iterable, an object for an
595
+ * object, a Map for a Map, and what all() holds for a collection
593
596
  *
594
597
  * @see https://tolki.abe.dev/strings/string-utilities-list.html#remove
595
598
  */
596
- export declare function remove(search: string | Iterable<string>, subject: string, caseSensitive?: boolean): string;
597
- export declare function remove(search: string | Iterable<string>, subject: Iterable<string>, caseSensitive?: boolean): string[];
598
- export declare function remove(search: string | Iterable<string>, subject: string | Iterable<string>, caseSensitive?: boolean): string | string[];
599
+ export declare function remove<TSubject extends StringSubject<TSubject>>(search: string | Iterable<string>, subject: TSubject, caseSensitive?: boolean): StringSubjectResult<TSubject>;
599
600
  /**
600
601
  * Reverse the given string.
601
602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} from "./trimmer/index.js";
5
5
  import { createUlidsNormally as c } from "./ulid/index.js";
6
6
  import { createUuidsNormally as l } from "./uuid/index.js";
7
- import { isArray as u, isFunction as d, isNull as f, isNumber as p, isString as m, isUndefined as h, phpStringCast as g, toLower as _ } from "@tolki/utils";
7
+ import { hasOwnToString as u, isArray as d, isFunction as f, isIterable as p, isMap as m, isNull as h, isNumber as g, isObject as _, isPlainObject as v, isString as y, isUndefined as ee, phpStringCast as b, toLower as x } from "@tolki/utils";
8
8
  // src/str.ts
9
- var v = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), x = null;
10
- function S(e, t) {
9
+ var S = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), T = null;
10
+ function E(e, t) {
11
11
  if (t === "") return e;
12
12
  let n = String(t), r = e.indexOf(n);
13
13
  return r === -1 ? e : e.slice(r + n.length);
14
14
  }
15
- function ee(e, t) {
15
+ function te(e, t) {
16
16
  if (t === "") return e;
17
17
  let n = e.lastIndexOf(String(t));
18
18
  return n === -1 ? e : e.slice(n + String(t).length);
19
19
  }
20
- function C(e, t) {
20
+ function D(e, t) {
21
21
  if (t === "") return e;
22
22
  let n = e.indexOf(String(t));
23
23
  return n === -1 ? e : e.slice(0, n);
24
24
  }
25
- function w(e, t) {
25
+ function O(e, t) {
26
26
  if (t === "") return e;
27
27
  let n = e.lastIndexOf(String(t));
28
28
  return n === -1 ? e : i(e, 0, n);
29
29
  }
30
- function te(e, t, n) {
31
- return t === "" || n === "" ? e : w(S(e, t), n);
32
- }
33
30
  function ne(e, t, n) {
34
- return t === "" || n === "" ? e : C(S(e, t), n);
31
+ return t === "" || n === "" ? e : O(E(e, t), n);
35
32
  }
36
- function re(e) {
37
- if (y.has(e)) return y.get(e);
33
+ function re(e, t, n) {
34
+ return t === "" || n === "" ? e : D(E(e, t), n);
35
+ }
36
+ function ie(e) {
37
+ if (C.has(e)) return C.get(e);
38
38
  let t = Y(J(e));
39
- return y.set(e, t), t;
39
+ return C.set(e, t), t;
40
40
  }
41
- function ie(e, t) {
41
+ function ae(e, t) {
42
42
  let n = e.length;
43
43
  return !(t < 0 ? t < -n : t > n - 1) && (t < 0 && (t += n), e.charAt(t));
44
44
  }
45
- function ae(e, t) {
46
- for (let n of u(t) ? t : [t]) if (n !== "" && e.startsWith(n)) {
45
+ function oe(e, t) {
46
+ for (let n of d(t) ? t : [t]) if (n !== "" && e.startsWith(n)) {
47
47
  let t = [...e], r = [...n];
48
48
  return t.slice(r.length).join("");
49
49
  }
50
50
  return e;
51
51
  }
52
- function oe(e, t) {
53
- for (let n of u(t) ? t : [t]) if (n !== "" && e.endsWith(n)) {
52
+ function se(e, t) {
53
+ for (let n of d(t) ? t : [t]) if (n !== "" && e.endsWith(n)) {
54
54
  let t = [...e], r = [...n];
55
55
  return t.slice(0, -r.length).join("");
56
56
  }
57
57
  return e;
58
58
  }
59
- function T(e, t, n = !1) {
59
+ function k(e, t, n = !1) {
60
60
  n && (e = e.toLowerCase());
61
61
  let r;
62
62
  r = typeof t == "string" ? [t] : Array.from(t);
63
63
  for (let t of r) if (n && (t = t.toLowerCase()), t !== "" && e.includes(t)) return !0;
64
64
  return !1;
65
65
  }
66
- function se(e, t = "", n = {}) {
66
+ function ce(e, t = "", n = {}) {
67
67
  let { radius: r = 100, omission: s = "..." } = n, c = String(e ?? ""), l = RegExp(`^(.*?)(${((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))(t ?? "")})(.*)$`, "iu").exec(c);
68
68
  if (!l) return null;
69
69
  let u = String(l[1]), d = String(l[2]), f = String(l[3]), p = a(u), m = Array.from(p).length, h = i(p, Math.max(m - r, 0), r), g = a(h);
@@ -71,59 +71,59 @@ function se(e, t = "", n = {}) {
71
71
  let _ = o(f), v = i(_, 0, r), y = o(v);
72
72
  return y !== _ && (y += s), g + d + y;
73
73
  }
74
- function ce(e, t, n = !1) {
74
+ function le(e, t, n = !1) {
75
75
  let r = !1;
76
- for (let i of t) if (r = !0, !T(e, i, n)) return !1;
76
+ for (let i of t) if (r = !0, !k(e, i, n)) return !1;
77
77
  return r;
78
78
  }
79
- function le(e, t, n = !1) {
80
- return !T(e, t, n);
79
+ function ue(e, t, n = !1) {
80
+ return !k(e, t, n);
81
81
  }
82
- function ue(e, t = " ") {
83
- return u(t) ? (t.forEach((t) => {
82
+ function de(e, t = " ") {
83
+ return d(t) ? (t.forEach((t) => {
84
84
  e = e.replace(RegExp(`${t}+`, "g"), t);
85
85
  }), e) : e.replace(RegExp(`${t}+`, "g"), t);
86
86
  }
87
- function E(e, t) {
87
+ function A(e, t) {
88
88
  if (e === null) return !1;
89
- e = String(e), t = u(t) ? Array.from(t) : [String(t)];
89
+ e = String(e), t = d(t) ? Array.from(t) : [String(t)];
90
90
  for (let n of t) if (n !== "" && e.endsWith(n)) return !0;
91
91
  return !1;
92
92
  }
93
- function de(e, t) {
94
- return !E(e, t);
95
- }
96
93
  function fe(e, t) {
97
- let n = g(e), r = g(t);
94
+ return !A(e, t);
95
+ }
96
+ function pe(e, t) {
97
+ let n = b(e), r = b(t);
98
98
  if (r === "") return n;
99
99
  let i = n.length;
100
100
  for (; n.endsWith(r, i);) i -= r.length;
101
101
  return `${n.slice(0, i)}${r}`;
102
102
  }
103
- function pe(e, t, n = null) {
103
+ function me(e, t, n = null) {
104
104
  return t + e + (n ?? t);
105
105
  }
106
- function me(e, t, n = null) {
107
- return q(e, t) && (e = i(e, O(t))), E(e, n ??= t) && (e = i(e, 0, -O(n))), e;
106
+ function he(e, t, n = null) {
107
+ return q(e, t) && (e = i(e, M(t))), A(e, n ??= t) && (e = i(e, 0, -M(n))), e;
108
108
  }
109
- function he(e, t, n = !1) {
109
+ function ge(e, t, n = !1) {
110
110
  t = String(t);
111
111
  let r;
112
112
  r = typeof e == "string" ? [e] : Array.from(e);
113
113
  for (let e of r) {
114
- if (e = String(e), e === t || n && _(e) === _(t)) return !0;
114
+ if (e = String(e), e === t || n && x(e) === x(t)) return !0;
115
115
  e = e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), e = e.replace(/\\\*/g, ".*");
116
116
  let r = n ? "iu" : "u";
117
117
  if (RegExp(`^${e}$`, r).test(t)) return !0;
118
118
  }
119
119
  return !1;
120
120
  }
121
- function D(e) {
121
+ function j(e) {
122
122
  for (let t = 0; t < e.length; t++) if (e.charCodeAt(t) > 127) return !1;
123
123
  return !0;
124
124
  }
125
- function ge(e) {
126
- if (!m(e)) return !1;
125
+ function _e(e) {
126
+ if (!y(e)) return !1;
127
127
  try {
128
128
  JSON.parse(e);
129
129
  } catch {
@@ -131,8 +131,8 @@ function ge(e) {
131
131
  }
132
132
  return !0;
133
133
  }
134
- function _e(e, t = []) {
135
- if (!m(e)) return !1;
134
+ function ve(e, t = []) {
135
+ if (!y(e)) return !1;
136
136
  let n = (t.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" : t.join("|")).split("|").map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
137
137
  try {
138
138
  let t = new URL(e), r = t.protocol.replace(":", ""), i = t.hostname, a = e.slice(e.indexOf("://") + 3).startsWith("/"), o = i.length > 0 && !/^\.+$/.test(i) && !a, s = r === "file" && a;
@@ -158,28 +158,28 @@ function _e(e, t = []) {
158
158
  ].join("");
159
159
  return new RegExp(r, "iu").test(e);
160
160
  }
161
- function ve(e) {
161
+ function ye(e) {
162
162
  return K(e, "-");
163
163
  }
164
- function O(e) {
164
+ function M(e) {
165
165
  return e.length;
166
166
  }
167
- function ye(e, t = 100, n = "...", r = !1) {
167
+ function be(e, t = 100, n = "...", r = !1) {
168
168
  if (e.length <= t) return e;
169
169
  if (!r) return e.slice(0, t).trimEnd() + n;
170
170
  e = G(e).replace(/[\n\r]+/g, " ").trim();
171
171
  let i = e.slice(0, t).trimEnd();
172
172
  return e.substring(t, t + 1) === " " || !/\s/.test(i) ? i + n : i.replace(/(.*)\s.*/, "$1") + n;
173
173
  }
174
- function k(e) {
175
- return _(e);
174
+ function N(e) {
175
+ return x(e);
176
176
  }
177
- function A(e, t = 100, n = "...") {
177
+ function xe(e, t = 100, n = "...") {
178
178
  if (t <= 0) return e;
179
179
  let r = RegExp(`^\\s*(?:\\S+\\s*){1,${t}}`, "u"), i = e.match(r);
180
- return !i || O(e) === O(i[0]) ? e : i[0].trimEnd() + n;
180
+ return !i || M(e) === M(i[0]) ? e : i[0].trimEnd() + n;
181
181
  }
182
- function j(e, t, n, r = null) {
182
+ function Se(e, t, n, r = null) {
183
183
  if (t === "") return e;
184
184
  let i = e.length, a = n;
185
185
  n < 0 && (a = n < -i ? 0 : i + n);
@@ -188,7 +188,7 @@ function j(e, t, n, r = null) {
188
188
  let s = e.slice(0, a), c = o.length, l = e.slice(a + c);
189
189
  return s + t.slice(0, 1).repeat(c) + l;
190
190
  }
191
- function M(e, t) {
191
+ function Ce(e, t) {
192
192
  let n = "u", r = e;
193
193
  if (e.length >= 2 && e[0] === "/") {
194
194
  let t = -1;
@@ -213,7 +213,7 @@ function M(e, t) {
213
213
  return "";
214
214
  }
215
215
  }
216
- function N(e, t) {
216
+ function we(e, t) {
217
217
  t = String(t);
218
218
  let n = typeof e == "string" ? [e] : Array.from(e);
219
219
  for (let e of n) {
@@ -241,7 +241,7 @@ function N(e, t) {
241
241
  }
242
242
  return !1;
243
243
  }
244
- function P(e, t) {
244
+ function Te(e, t) {
245
245
  let n = "u", r = e;
246
246
  if (e.length >= 2 && e[0] === "/") {
247
247
  let t = -1;
@@ -269,29 +269,29 @@ function P(e, t) {
269
269
  }
270
270
  return i;
271
271
  }
272
- function be(e) {
273
- return u(e) ? e.map((e) => e.replace(/\D/g, "")) : e.replace(/\D/g, "");
272
+ function Ee(e) {
273
+ return d(e) ? e.map((e) => e.replace(/\D/g, "")) : e.replace(/\D/g, "");
274
274
  }
275
- function xe(e, t, n = " ") {
275
+ function De(e, t, n = " ") {
276
276
  let r = e.length;
277
277
  if (t <= r || n === "") return e;
278
278
  let i = t - r, a = Math.floor(i / 2), o = i - a;
279
- return F(n, a) + e + F(n, o);
279
+ return P(n, a) + e + P(n, o);
280
280
  }
281
- function Se(e, t, n = " ") {
281
+ function Oe(e, t, n = " ") {
282
282
  let r = e.length;
283
- return t <= r || n === "" ? e : F(n, t - r) + e;
283
+ return t <= r || n === "" ? e : P(n, t - r) + e;
284
284
  }
285
- function Ce(e, t, n = " ") {
285
+ function ke(e, t, n = " ") {
286
286
  let r = e.length;
287
- return t <= r || n === "" ? e : e + F(n, t - r);
287
+ return t <= r || n === "" ? e : e + P(n, t - r);
288
288
  }
289
- function F(e, t) {
289
+ function P(e, t) {
290
290
  if (t <= 0 || e.length === 0) return "";
291
291
  let n = Math.ceil(t / e.length);
292
292
  return e.repeat(n).slice(0, t);
293
293
  }
294
- function we(e = 32, t = !0, r = !0, i = !0, a = !1) {
294
+ function Ae(e = 32, t = !0, r = !0, i = !0, a = !1) {
295
295
  let o = [
296
296
  t ? /* @__PURE__ */ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("") : null,
297
297
  r ? [
@@ -308,12 +308,12 @@ function we(e = 32, t = !0, r = !0, i = !0, a = !1) {
308
308
  ] : null,
309
309
  i ? /* @__PURE__ */ "~!#$%^&*()-_.,<>?/\\{}[]|:;".split("") : null,
310
310
  a ? [" "] : null
311
- ].filter((e) => u(e));
311
+ ].filter((e) => d(e));
312
312
  if (o.length === 0) throw Error("At least one character pool must be enabled.");
313
- let s = o.flat(), c = I(o).slice(0, Math.max(0, e)).map((e) => e[n(0, e.length - 1)]), l = Array.from({ length: Math.max(0, e - c.length) }, () => s[n(0, s.length - 1)]);
314
- return I([...c, ...l]).join("");
313
+ let s = o.flat(), c = F(o).slice(0, Math.max(0, e)).map((e) => e[n(0, e.length - 1)]), l = Array.from({ length: Math.max(0, e - c.length) }, () => s[n(0, s.length - 1)]);
314
+ return F([...c, ...l]).join("");
315
315
  }
316
- function I(e) {
316
+ function F(e) {
317
317
  let t = [...e];
318
318
  for (let e = t.length - 1; e > 0; e--) {
319
319
  let r = n(0, e);
@@ -321,7 +321,7 @@ function I(e) {
321
321
  }
322
322
  return t;
323
323
  }
324
- function Te(e, t, n = 0) {
324
+ function je(e, t, n = 0) {
325
325
  if (t === "") return !1;
326
326
  let r = Array.from(e), i = Array.from(t), a = n >= 0 ? n : r.length + n;
327
327
  if (a < 0 && (a = 0), a >= r.length) return !1;
@@ -336,30 +336,30 @@ function Te(e, t, n = 0) {
336
336
  }
337
337
  return !1;
338
338
  }
339
- function L(e = 16) {
340
- return (x ?? ((e) => r(e)))(e);
339
+ function I(e = 16) {
340
+ return (T ?? ((e) => r(e)))(e);
341
341
  }
342
- function R(e) {
343
- x = e;
342
+ function L(e) {
343
+ T = e;
344
344
  }
345
- function Ee(e, t) {
345
+ function Me(e, t) {
346
346
  let n = 0, r = t ?? function(e) {
347
- let t = x;
348
- x = null;
349
- let r = L(e);
350
- return x = t, n++, r;
347
+ let t = T;
348
+ T = null;
349
+ let r = I(e);
350
+ return T = t, n++, r;
351
351
  };
352
- R((t) => n < e.length ? String(e[n++]) : r(t));
352
+ L((t) => n < e.length ? String(e[n++]) : r(t));
353
353
  }
354
- function z() {
355
- x = null;
354
+ function R() {
355
+ T = null;
356
356
  }
357
- function De(e, t) {
357
+ function Ne(e, t) {
358
358
  return t <= 0 ? "" : e.repeat(t);
359
359
  }
360
- function Oe(e, t, n) {
360
+ function Pe(e, t, n) {
361
361
  let r;
362
- r = typeof t == "object" && !u(t) ? Object.values(t) : u(t) ? [...t] : Array.from(t);
362
+ r = typeof t == "object" && !d(t) ? Object.values(t) : d(t) ? [...t] : Array.from(t);
363
363
  let i = n.split(e);
364
364
  if (i.length === 1) return n;
365
365
  let a = i[0];
@@ -369,7 +369,7 @@ function Oe(e, t, n) {
369
369
  }
370
370
  return String(a);
371
371
  }
372
- function ke(e, t) {
372
+ function z(e, t) {
373
373
  try {
374
374
  let t = String(e);
375
375
  if (t.length) return t;
@@ -378,42 +378,44 @@ function ke(e, t) {
378
378
  return t;
379
379
  }
380
380
  }
381
- function Ae(e, t, n, r = !0) {
382
- if (m(e) && !m(t)) throw TypeError("The replacement must be a string when the search term is a string.");
383
- let i = m(n) ? n : Array.from(n, (e) => V(e));
384
- if (!r) return B(e, t, i);
385
- let a = m(e) ? [e] : Array.from(e, (e) => V(e)), o = m(t) ? a.map(() => t) : Array.from(t, (e) => V(e)), s = (e) => a.reduce((e, t, n) => t === "" ? e : e.split(t).join(o[n] ?? ""), e);
386
- return m(i) ? s(i) : i.map(s);
387
- }
388
- function B(e, t, n) {
389
- let r = m(e) ? [e] : Array.from(e, (e) => V(e)), i = m(t) ? r.map(() => t) : Array.from(t, (e) => V(e)), a = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), o = (e) => r.reduce((e, t, n) => {
390
- if (t === "") return e;
391
- let r = i[n] ?? "", o = new RegExp(a(t), D(t) ? "gi" : "giu");
392
- return e.replace(o, () => r);
393
- }, e);
394
- return m(n) ? o(n) : n.map(o);
395
- }
396
- function V(e) {
397
- return f(e) || h(e) ? "" : String(e);
398
- }
399
- function H(e, t, n) {
381
+ function B(e, t, n, r = !0) {
382
+ if (y(e) && !y(t)) throw TypeError("The replacement must be a string when the search term is a string.");
383
+ let i = y(e) ? [e] : Array.from(e, (e) => H(e)), a = y(t) ? i.map(() => t) : Array.from(t, (e) => H(e));
384
+ return V(n, (e) => r ? i.reduce((e, t, n) => t === "" ? e : e.split(t).join(a[n] ?? ""), e) : Fe(i, a, e));
385
+ }
386
+ function Fe(e, t, n) {
387
+ let r = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
388
+ return e.reduce((e, n, i) => {
389
+ if (n === "") return e;
390
+ let a = t[i] ?? "", o = new RegExp(r(n), j(n) ? "gi" : "giu");
391
+ return e.replace(o, () => a);
392
+ }, n);
393
+ }
394
+ function V(e, t) {
395
+ let n = (e) => Object.fromEntries(Object.entries(e).map(([e, n]) => [e, t(H(n))]));
396
+ return y(e) ? t(e) : d(e) ? e.map((e) => t(H(e))) : m(e) ? new Map(Array.from(e, ([e, n]) => [e, t(H(n))])) : v(e) ? n(e) : _(e) && f(e.all) ? V(e.all(), t) : p(e) ? Array.from(e, (e) => t(H(e))) : u(e) ? t(String(e)) : _(e) ? n(e) : t(H(e));
397
+ }
398
+ function H(e) {
399
+ return h(e) || ee(e) ? "" : String(e);
400
+ }
401
+ function U(e, t, n) {
400
402
  if (e = String(e), e === "") return n;
401
403
  let r = n.indexOf(e);
402
404
  return r === -1 ? n : n.slice(0, r) + t + n.slice(r + e.length);
403
405
  }
404
- function U(e, t, n) {
405
- return e = String(e), e === "" ? n : q(n, e) ? H(e, t, n) : n;
406
+ function Ie(e, t, n) {
407
+ return e = String(e), e === "" ? n : q(n, e) ? U(e, t, n) : n;
406
408
  }
407
409
  function W(e, t, n) {
408
410
  if (e = String(e), e === "") return n;
409
411
  let r = n.lastIndexOf(e);
410
412
  return r === -1 ? n : n.slice(0, r) + t + n.slice(r + e.length);
411
413
  }
412
- function je(e, t, n) {
413
- return e = String(e), e === "" ? n : E(n, e) ? W(e, t, n) : n;
414
+ function Le(e, t, n) {
415
+ return e = String(e), e === "" ? n : A(n, e) ? W(e, t, n) : n;
414
416
  }
415
- function Me(e, t, n, r = -1) {
416
- let i = (e) => u(e) ? e : [e], a = i(e);
417
+ function Re(e, t, n, r = -1) {
418
+ let i = (e) => d(e) ? e : [e], a = i(e);
417
419
  function o(e) {
418
420
  try {
419
421
  if (e instanceof RegExp) {
@@ -448,7 +450,7 @@ function Me(e, t, n, r = -1) {
448
450
  if (!t) return null;
449
451
  s.push(t);
450
452
  }
451
- let c = d(t), l = c ? [] : i(t), f = (e) => {
453
+ let c = f(t), l = c ? [] : i(t), u = (e) => {
452
454
  let n = e;
453
455
  for (let e = 0; e < s.length; e++) {
454
456
  let i = s[e];
@@ -481,7 +483,7 @@ function Me(e, t, n, r = -1) {
481
483
  }
482
484
  return n;
483
485
  };
484
- return u(n) ? n.map(f) : f(n);
486
+ return d(n) ? n.map(u) : u(n);
485
487
  }
486
488
  function G(e) {
487
489
  let t = "", n = !1;
@@ -491,37 +493,30 @@ function G(e) {
491
493
  }
492
494
  return t;
493
495
  }
494
- function Ne(e, t, n = !0) {
495
- let r = m(t) ? t : Array.from(t, (e) => V(e));
496
- if (!n) return B(e, "", r);
497
- let i = m(e) ? [e] : Array.from(e, (e) => V(e)), a = (e) => {
498
- let t = e;
499
- for (let e of i) e !== "" && (t = t.split(e).join(""));
500
- return t;
501
- };
502
- return m(r) ? a(r) : r.map(a);
496
+ function ze(e, t, n = !0) {
497
+ return B(e, "", t, n);
503
498
  }
504
- function Pe(e) {
499
+ function Be(e) {
505
500
  return Array.from(e).reverse().join("");
506
501
  }
507
- function Fe(e, t) {
508
- let n = g(e), r = g(t);
502
+ function Ve(e, t) {
503
+ let n = b(e), r = b(t);
509
504
  if (r === "") return n;
510
505
  let i = 0;
511
506
  for (; n.startsWith(r, i);) i += r.length;
512
507
  return `${r}${n.slice(i)}`;
513
508
  }
514
- function Ie(t) {
509
+ function He(t) {
515
510
  let n = String(t).trim();
516
511
  if (n === "") return "";
517
512
  let r = n.split(/\s+/u);
518
513
  return r = r.length > 1 ? r.map((t) => e(t)) : X(r.join("_")).map((t) => e(t)), r.join("_").replace(/[-_ ]+/gu, "_").split("_").filter((e) => e.length > 0).join(" ");
519
514
  }
520
- function Le(e, n = !1) {
515
+ function Ue(e, n = !1) {
521
516
  let r = e.split(/\s+/u).filter((e) => e.length > 0).map((e) => [...e][0]).join("");
522
517
  return n ? t(r) : r;
523
518
  }
524
- function Re(e) {
519
+ function We(e) {
525
520
  if (e.trim() === "") return e;
526
521
  let t = /* @__PURE__ */ new Set(/* @__PURE__ */ "and.as.but.for.if.nor.or.so.yet.a.an.the.at.by.for.in.of.off.on.per.to.up.via.et.ou.un.une.la.le.les.de.du.des.par.à".split(".")), n = /* @__PURE__ */ new Set([
527
522
  ".",
@@ -549,17 +544,17 @@ function Re(e) {
549
544
  }
550
545
  function K(e, t = "_") {
551
546
  let n = `${e}|${t}`;
552
- if (v.has(n)) return v.get(n);
547
+ if (S.has(n)) return S.get(n);
553
548
  let r = e;
554
- return /^[a-z]+$/.test(e) || (r = Z(e).replace(/\s+/gu, ""), r = r.replace(/(.)(?=[A-Z])/g, `$1${t}`), r = k(r)), v.set(n, r), r;
549
+ return /^[a-z]+$/.test(e) || (r = Z(e).replace(/\s+/gu, ""), r = r.replace(/(.)(?=[A-Z])/g, `$1${t}`), r = N(r)), S.set(n, r), r;
555
550
  }
556
- function ze(e) {
551
+ function Ge(e) {
557
552
  return s(e).replace(/[\s\u3164\u1160]+/gu, " ");
558
553
  }
559
554
  function q(e, t) {
560
555
  if (e == null || t == null) return !1;
561
556
  let n;
562
- n = m(t) || p(t) ? [t] : Symbol.iterator in Object(t) ? Array.from(t) : [t];
557
+ n = y(t) || g(t) ? [t] : Symbol.iterator in Object(t) ? Array.from(t) : [t];
563
558
  let r = String(e);
564
559
  for (let e of n) {
565
560
  if (e == null) continue;
@@ -568,25 +563,25 @@ function q(e, t) {
568
563
  }
569
564
  return !1;
570
565
  }
571
- function Be(e, t) {
566
+ function Ke(e, t) {
572
567
  return !q(e, t);
573
568
  }
574
569
  function J(e, t = !1) {
575
570
  let n = e;
576
571
  t && (n = e.replace(/(^|[-_ \s])([A-Z]+)(?=[-_ \s]|$)/gu, (e, t, n) => t + n.toLowerCase()));
577
572
  let r = n;
578
- if (b.has(r)) return b.get(r);
573
+ if (w.has(r)) return w.get(r);
579
574
  let i = String(n).replace(/[-_]+/g, " "), a = (i.trim() === "" ? [] : i.split(/\s+/u)).map((e) => {
580
575
  if (!e) return e;
581
576
  let t = Array.from(e);
582
577
  return t[0].toUpperCase() + t.slice(1).join("");
583
578
  }).join("");
584
- return b.set(r, a), a;
579
+ return w.set(r, a), a;
585
580
  }
586
- function Ve(e, t = !1) {
581
+ function qe(e, t = !1) {
587
582
  return J(e, t);
588
583
  }
589
- function He(e, t) {
584
+ function Je(e, t) {
590
585
  if (!e || Object.keys(e).length === 0) return t;
591
586
  let n = Object.keys(e).filter((e) => e !== "");
592
587
  if (n.length === 0) return t;
@@ -594,23 +589,23 @@ function He(e, t) {
594
589
  let r = new RegExp(n.map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), "gu");
595
590
  return t.replace(r, (t) => e[t]);
596
591
  }
597
- function Ue(e, t) {
592
+ function Ye(e, t) {
598
593
  return t < 0 ? i(e, t) : i(e, 0, t);
599
594
  }
600
595
  function Y(e) {
601
- return k(i(e, 0, 1)) + i(e, 1);
596
+ return N(i(e, 0, 1)) + i(e, 1);
602
597
  }
603
- function We(e) {
598
+ function Xe(e) {
604
599
  return t(i(e, 0, 1)) + i(e, 1);
605
600
  }
606
601
  function X(e) {
607
602
  return e.split(/(?=\p{Lu})/u).filter(Boolean);
608
603
  }
609
604
  function Z(e, t = " \r\n\f\v") {
610
- let n = u(t) ? t.join("") : t, r = n.length ? ((e) => e.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"))(n) : "", i = r.length ? `(?:\\s|[${r}])` : "\\s", a = RegExp(`(^|${i})(\\p{Ll})`, "gu");
605
+ let n = d(t) ? t.join("") : t, r = n.length ? ((e) => e.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"))(n) : "", i = r.length ? `(?:\\s|[${r}])` : "\\s", a = RegExp(`(^|${i})(\\p{Ll})`, "gu");
611
606
  return e.replace(a, (e, t, n) => t + n.toUpperCase());
612
607
  }
613
- function Ge(e, t = null) {
608
+ function Ze(e, t = null) {
614
609
  let n = t && t.length > 0 ? t.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&") : "", r = n.length > 0 ? RegExp(`[\\p{L}\\p{N}${n}]+`, "gu") : /[\p{L}\p{N}]+/gu, i = e.match(r);
615
610
  return i ? i.length : 0;
616
611
  }
@@ -622,12 +617,12 @@ function $(e, t, n) {
622
617
  for (; r < n && Q(e[r]);) r++;
623
618
  return r;
624
619
  }
625
- function Ke(e, t, n) {
620
+ function Qe(e, t, n) {
626
621
  let r = n;
627
622
  for (; r > t && Q(e[r - 1]);) r--;
628
623
  return r;
629
624
  }
630
- function qe(e, t = 75, n = "\n", r = !1) {
625
+ function $e(e, t = 75, n = "\n", r = !1) {
631
626
  if (e.length === 0 || t < 1 || n === "") return e;
632
627
  let i = e.split(/\r\n|\n|\r/), a = [];
633
628
  for (let e of i) {
@@ -642,7 +637,7 @@ function qe(e, t = 75, n = "\n", r = !1) {
642
637
  a.push(n.slice(o, i).join(""));
643
638
  break;
644
639
  }
645
- let e = Ke(n, o, o + t);
640
+ let e = Qe(n, o, o + t);
646
641
  a.push(n.slice(o, e).join("")), o += t;
647
642
  }
648
643
  else {
@@ -674,19 +669,19 @@ function qe(e, t = 75, n = "\n", r = !1) {
674
669
  }
675
670
  return a.join(n);
676
671
  }
677
- function Je() {
678
- return v.size;
672
+ function et() {
673
+ return S.size;
679
674
  }
680
- function Ye() {
681
- return y.size;
675
+ function tt() {
676
+ return C.size;
682
677
  }
683
- function Xe() {
684
- return b.size;
678
+ function nt() {
679
+ return w.size;
685
680
  }
686
- function Ze() {
687
- v.clear(), y.clear(), b.clear();
681
+ function rt() {
682
+ S.clear(), C.clear(), w.clear();
688
683
  }
689
- function Qe() {
690
- z(), c(), l();
684
+ function it() {
685
+ R(), c(), l();
691
686
  }
692
- export { S as after, ee as afterLast, Re as apa, C as before, w as beforeLast, te as between, ne as betweenFirst, re as camel, Ye as camelCacheSize, ie as charAt, oe as chopEnd, ae as chopStart, T as contains, ce as containsAll, z as createRandomStringsNormally, R as createRandomStringsUsing, Ee as createRandomStringsUsingSequence, ue as deduplicate, le as doesntContain, de as doesntEndWith, Be as doesntStartWith, E as endsWith, se as excerpt, fe as finish, Ze as flushCache, Ie as headline, Le as initials, he as is, D as isAscii, ge as isJson, N as isMatch, _e as isUrl, ve as kebab, Y as lcfirst, O as length, ye as limit, k as lower, F as makePad, j as mask, M as match, P as matchAll, be as numbers, xe as padBoth, Se as padLeft, Ce as padRight, Ve as pascal, we as password, Te as position, L as random, Ne as remove, De as repeat, Ae as replace, Oe as replaceArray, je as replaceEnd, H as replaceFirst, W as replaceLast, Me as replaceMatches, U as replaceStart, Qe as resetFactoryState, Pe as reverse, K as snake, Je as snakeCacheSize, ze as squish, Fe as start, q as startsWith, G as stripTags, J as studly, Xe as studlyCacheSize, He as swap, Ue as take, ke as toStringOr, We as ucfirst, X as ucsplit, Z as ucwords, me as unwrap, Ge as wordCount, qe as wordWrap, A as words, pe as wrap };
687
+ export { E as after, te as afterLast, We as apa, D as before, O as beforeLast, ne as between, re as betweenFirst, ie as camel, tt as camelCacheSize, ae as charAt, se as chopEnd, oe as chopStart, k as contains, le as containsAll, R as createRandomStringsNormally, L as createRandomStringsUsing, Me as createRandomStringsUsingSequence, de as deduplicate, ue as doesntContain, fe as doesntEndWith, Ke as doesntStartWith, A as endsWith, ce as excerpt, pe as finish, rt as flushCache, He as headline, Ue as initials, ge as is, j as isAscii, _e as isJson, we as isMatch, ve as isUrl, ye as kebab, Y as lcfirst, M as length, be as limit, N as lower, P as makePad, Se as mask, Ce as match, Te as matchAll, Ee as numbers, De as padBoth, Oe as padLeft, ke as padRight, qe as pascal, Ae as password, je as position, I as random, ze as remove, Ne as repeat, B as replace, Pe as replaceArray, Le as replaceEnd, U as replaceFirst, W as replaceLast, Re as replaceMatches, Ie as replaceStart, it as resetFactoryState, Be as reverse, K as snake, et as snakeCacheSize, Ge as squish, Ve as start, q as startsWith, G as stripTags, J as studly, nt as studlyCacheSize, Je as swap, Ye as take, z as toStringOr, Xe as ucfirst, X as ucsplit, Z as ucwords, he as unwrap, Ze as wordCount, $e as wordWrap, xe as words, me as wrap };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tolki/str",
3
- "version": "1.7.1",
3
+ "version": "1.8.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,9 @@
36
36
  "transliteration": "^2.7.0",
37
37
  "ulid": "^3.0.2",
38
38
  "uuid": "^14.0.3",
39
+ "@tolki/num": "^2.2.5",
39
40
  "@tolki/utils": "^1.6.3",
40
- "@tolki/num": "^2.2.5"
41
+ "@tolki/types": "^1.12.0"
41
42
  },
42
43
  "files": [
43
44
  "dist"