@tolki/str 1.7.0 → 1.7.1

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.
@@ -1,41 +1,26 @@
1
- import { transliterate as y } from "transliteration";
2
- import { lower as h } from "../str.js";
3
- function k(n) {
4
- return y(n);
1
+ import { lower as e } from "../str.js";
2
+ import { transliterate as t } from "transliteration";
3
+ // src/ascii/index.ts
4
+ function n(e) {
5
+ return t(e);
5
6
  }
6
- function j(n, u = "-", p = { "@": "at" }) {
7
- const s = u, r = (t) => t.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"), a = (t) => t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), l = (t) => {
8
- let e = t;
9
- const $ = s === "-" ? "_" : "-", m = new RegExp(`[${r($)}]+`, "gu");
10
- e = e.replace(m, s);
11
- const i = {};
12
- for (const [o, c] of Object.entries(p))
13
- i[o] = s + c + s;
14
- for (const [o, c] of Object.entries(i))
15
- o !== "" && (e = e.split(o).join(c));
16
- if (e = h(e), s === "")
17
- return e = e.replace(/[^\p{L}\p{N}\s]+/gu, ""), e = e.replace(/[\s]+/gu, ""), e;
18
- {
19
- const o = new RegExp(
20
- `[^${r(s)}\\p{L}\\p{N}\\s]+`,
21
- "gu"
22
- );
23
- e = e.replace(o, "");
24
- const c = new RegExp(
25
- `[${r(s)}\\s]+`,
26
- "gu"
27
- );
28
- e = e.replace(c, s);
29
- const w = new RegExp(
30
- `^${a(s)}+|${a(s)}+$`,
31
- "gu"
32
- );
33
- return e = e.replace(w, ""), e;
34
- }
35
- }, g = l(n), f = l(k(n));
36
- return Object.keys(p).some((t) => /[A-Za-z0-9]/.test(t)) ? f : g;
7
+ function r(t, r = "-", i = { "@": "at" }) {
8
+ let a = r, o = (e) => e.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"), s = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), c = (t) => {
9
+ let n = t, r = RegExp(`[${o(a === "-" ? "_" : "-")}]+`, "gu");
10
+ n = n.replace(r, a);
11
+ let c = {};
12
+ for (let [e, t] of Object.entries(i)) c[e] = a + t + a;
13
+ for (let [e, t] of Object.entries(c)) e !== "" && (n = n.split(e).join(t));
14
+ if (n = e(n), a === "") return n = n.replace(/[^\p{L}\p{N}\s]+/gu, ""), n = n.replace(/[\s]+/gu, ""), n;
15
+ {
16
+ let e = RegExp(`[^${o(a)}\\p{L}\\p{N}\\s]+`, "gu");
17
+ n = n.replace(e, "");
18
+ let t = RegExp(`[${o(a)}\\s]+`, "gu");
19
+ n = n.replace(t, a);
20
+ let r = RegExp(`^${s(a)}+|${s(a)}+$`, "gu");
21
+ return n = n.replace(r, ""), n;
22
+ }
23
+ }, l = c(t), u = c(n(t));
24
+ return Object.keys(i).some((e) => /[A-Za-z0-9]/.test(e)) ? u : l;
37
25
  }
38
- export {
39
- k as ascii,
40
- j as slug
41
- };
26
+ export { n as ascii, r as slug };
@@ -1,126 +1,98 @@
1
- import { isFunction as u } from "@tolki/utils";
2
- function T(o) {
3
- const n = g();
4
- if (n.Buffer && u(n.Buffer.from))
5
- return n.Buffer.from(o, "utf8").toString("base64");
6
- if (u(n.btoa))
7
- try {
8
- const e = d(o);
9
- return n.btoa(e);
10
- } catch {
11
- return n.btoa(o);
12
- }
13
- const t = d(o);
14
- return b(t);
1
+ import { isFunction as e } from "@tolki/utils";
2
+ // src/base64/index.ts
3
+ function t(t) {
4
+ let n = i();
5
+ if (n.Buffer && e(n.Buffer.from)) return n.Buffer.from(t, "utf8").toString("base64");
6
+ if (e(n.btoa)) try {
7
+ let e = a(t);
8
+ return n.btoa(e);
9
+ } catch {
10
+ return n.btoa(t);
11
+ }
12
+ return o(a(t));
15
13
  }
16
- function w(o) {
17
- const n = g();
18
- if (n.Buffer && u(n.Buffer.from))
19
- return n.Buffer.from(o).toString("base64");
20
- let t = "";
21
- for (let e = 0; e < o.length; e++)
22
- t += String.fromCharCode(o[e]);
23
- return u(n.btoa) ? n.btoa(t) : b(t);
14
+ function n(t) {
15
+ let n = i();
16
+ if (n.Buffer && e(n.Buffer.from)) return n.Buffer.from(t).toString("base64");
17
+ let r = "";
18
+ for (let e = 0; e < t.length; e++) r += String.fromCharCode(t[e]);
19
+ return e(n.btoa) ? n.btoa(r) : o(r);
24
20
  }
25
- function y(o, n = !1) {
26
- const t = g();
27
- let e = String(o);
28
- if (n) {
29
- const r = e.replace(/\s+/g, "");
30
- if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(r))
31
- return !1;
32
- e = r;
33
- } else
34
- e = e.replace(/[^A-Za-z0-9+/=]/g, "");
35
- if (t.Buffer && u(t.Buffer.from))
36
- try {
37
- return t.Buffer.from(e, "base64").toString("utf8");
38
- } catch {
39
- return !1;
40
- }
41
- if (u(t.atob))
42
- try {
43
- const r = t.atob(e);
44
- if (typeof t.TextDecoder == "function") {
45
- const c = new Uint8Array(r.length);
46
- for (let a = 0; a < r.length; a++)
47
- c[a] = r.charCodeAt(a);
48
- return new t.TextDecoder("utf-8").decode(c);
49
- }
50
- let f = "";
51
- for (let c = 0; c < r.length; c++)
52
- f += "%" + r.charCodeAt(c).toString(16).padStart(2, "0");
53
- return decodeURIComponent(f);
54
- } catch {
55
- return !1;
56
- }
57
- try {
58
- const r = C(e);
59
- return B(r);
60
- } catch {
61
- return !1;
62
- }
21
+ function r(t, n = !1) {
22
+ let r = i(), a = String(t);
23
+ if (n) {
24
+ let e = a.replace(/\s+/g, "");
25
+ if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)) return !1;
26
+ a = e;
27
+ } else a = a.replace(/[^A-Za-z0-9+/=]/g, "");
28
+ if (r.Buffer && e(r.Buffer.from)) try {
29
+ return r.Buffer.from(a, "base64").toString("utf8");
30
+ } catch {
31
+ return !1;
32
+ }
33
+ if (e(r.atob)) try {
34
+ let e = r.atob(a);
35
+ if (typeof r.TextDecoder == "function") {
36
+ let t = new Uint8Array(e.length);
37
+ for (let n = 0; n < e.length; n++) t[n] = e.charCodeAt(n);
38
+ return new r.TextDecoder("utf-8").decode(t);
39
+ }
40
+ let t = "";
41
+ for (let n = 0; n < e.length; n++) t += "%" + e.charCodeAt(n).toString(16).padStart(2, "0");
42
+ return decodeURIComponent(t);
43
+ } catch {
44
+ return !1;
45
+ }
46
+ try {
47
+ return c(s(a));
48
+ } catch {
49
+ return !1;
50
+ }
63
51
  }
64
- function g() {
65
- return globalThis;
52
+ function i() {
53
+ return globalThis;
66
54
  }
67
- function d(o) {
68
- return encodeURIComponent(o).replace(
69
- /%([0-9A-F]{2})/g,
70
- (n, t) => String.fromCharCode(parseInt(t, 16))
71
- );
55
+ function a(e) {
56
+ return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g, (e, t) => String.fromCharCode(parseInt(t, 16)));
72
57
  }
73
- function b(o) {
74
- const n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
75
- let t = "";
76
- for (let e = 0; e < o.length; e += 3) {
77
- const r = o.charCodeAt(e), f = o.charCodeAt(e + 1), c = o.charCodeAt(e + 2), a = (r ?? 0) << 16 | (f ?? 0) << 8 | (c ?? 0), i = a >> 18 & 63, s = a >> 12 & 63, l = a >> 6 & 63, h = a & 63;
78
- isNaN(f) ? t += n.charAt(i) + n.charAt(s) + "==" : isNaN(c) ? t += n.charAt(i) + n.charAt(s) + n.charAt(l) + "=" : t += n.charAt(i) + n.charAt(s) + n.charAt(l) + n.charAt(h);
79
- }
80
- return t;
58
+ function o(e) {
59
+ let t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", n = "";
60
+ for (let r = 0; r < e.length; r += 3) {
61
+ let i = e.charCodeAt(r), a = e.charCodeAt(r + 1), o = e.charCodeAt(r + 2), s = (i ?? 0) << 16 | (a ?? 0) << 8 | (o ?? 0), c = s >> 18 & 63, l = s >> 12 & 63, u = s >> 6 & 63, d = s & 63;
62
+ n += isNaN(a) ? t.charAt(c) + t.charAt(l) + "==" : isNaN(o) ? t.charAt(c) + t.charAt(l) + t.charAt(u) + "=" : t.charAt(c) + t.charAt(l) + t.charAt(u) + t.charAt(d);
63
+ }
64
+ return n;
81
65
  }
82
- function C(o) {
83
- const n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", t = /* @__PURE__ */ new Map();
84
- for (let c = 0; c < n.length; c++)
85
- t.set(n[c], c);
86
- let e = o.length;
87
- for (; e > 0 && o[e - 1] === "="; ) e--;
88
- const r = o.slice(0, e), f = [];
89
- for (let c = 0; c < r.length; c += 4) {
90
- const a = t.has(r[c]) ? t.get(r[c]) : 64, i = t.has(r[c + 1]) ? t.get(r[c + 1]) : 64, s = t.has(r[c + 2]) ? t.get(r[c + 2]) : 64, l = t.has(r[c + 3]) ? t.get(r[c + 3]) : 64, h = a << 18 | i << 12 | (s & 63) << 6 | l & 63, p = h >> 16 & 255, A = h >> 8 & 255, m = h & 255;
91
- f.push(p), s !== 64 && f.push(A), l !== 64 && f.push(m);
92
- }
93
- return f;
66
+ function s(e) {
67
+ let t = /* @__PURE__ */ new Map();
68
+ for (let e = 0; e < 64; e++) t.set("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[e], e);
69
+ let n = e.length;
70
+ for (; n > 0 && e[n - 1] === "=";) n--;
71
+ let r = e.slice(0, n), i = [];
72
+ for (let e = 0; e < r.length; e += 4) {
73
+ let n = t.has(r[e]) ? t.get(r[e]) : 64, a = t.has(r[e + 1]) ? t.get(r[e + 1]) : 64, o = t.has(r[e + 2]) ? t.get(r[e + 2]) : 64, s = t.has(r[e + 3]) ? t.get(r[e + 3]) : 64, c = n << 18 | a << 12 | (o & 63) << 6 | s & 63, l = c >> 16 & 255, u = c >> 8 & 255, d = c & 255;
74
+ i.push(l), o !== 64 && i.push(u), s !== 64 && i.push(d);
75
+ }
76
+ return i;
94
77
  }
95
- function B(o) {
96
- const n = g();
97
- if (typeof n.TextDecoder == "function")
98
- return new n.TextDecoder("utf-8").decode(new Uint8Array(o));
99
- let t = "";
100
- for (let e = 0; e < o.length; ) {
101
- const r = o[e++];
102
- if (r < 128)
103
- t += String.fromCharCode(r);
104
- else if (r < 224) {
105
- const f = o[e++];
106
- t += String.fromCharCode((r & 31) << 6 | f & 63);
107
- } else if (r < 240) {
108
- const f = o[e++], c = o[e++];
109
- t += String.fromCharCode(
110
- (r & 15) << 12 | (f & 63) << 6 | c & 63
111
- );
112
- } else {
113
- const f = o[e++], c = o[e++], a = o[e++], s = ((r & 7) << 18 | (f & 63) << 12 | (c & 63) << 6 | a & 63) - 65536;
114
- t += String.fromCharCode(
115
- 55296 + (s >> 10 & 1023),
116
- 56320 + (s & 1023)
117
- );
118
- }
119
- }
120
- return t;
78
+ function c(e) {
79
+ let t = i();
80
+ if (typeof t.TextDecoder == "function") return new t.TextDecoder("utf-8").decode(new Uint8Array(e));
81
+ let n = "";
82
+ for (let t = 0; t < e.length;) {
83
+ let r = e[t++];
84
+ if (r < 128) n += String.fromCharCode(r);
85
+ else if (r < 224) {
86
+ let i = e[t++];
87
+ n += String.fromCharCode((r & 31) << 6 | i & 63);
88
+ } else if (r < 240) {
89
+ let i = e[t++], a = e[t++];
90
+ n += String.fromCharCode((r & 15) << 12 | (i & 63) << 6 | a & 63);
91
+ } else {
92
+ let i = e[t++], a = e[t++], o = e[t++], s = ((r & 7) << 18 | (i & 63) << 12 | (a & 63) << 6 | o & 63) - 65536;
93
+ n += String.fromCharCode(55296 + (s >> 10 & 1023), 56320 + (s & 1023));
94
+ }
95
+ }
96
+ return n;
121
97
  }
122
- export {
123
- w as bytesToBase64,
124
- y as fromBase64,
125
- T as toBase64
126
- };
98
+ export { n as bytesToBase64, r as fromBase64, t as toBase64 };
@@ -1,49 +1,34 @@
1
- import { upperFirst as o, lowerFirst as l, toLower as s, toUpper as n } from "@tolki/utils";
2
- const r = {
3
- upper: "upper",
4
- lower: "lower",
5
- title: "title",
6
- fold: "fold",
7
- simple: "simple",
8
- lower_simple: "lower_simple",
9
- title_simple: "title_simple",
10
- fold_simple: "fold_simple"
1
+ import { lowerFirst as e, toLower as t, toUpper as n, upperFirst as r } from "@tolki/utils";
2
+ // src/convertcase/index.ts
3
+ var i = {
4
+ upper: "upper",
5
+ lower: "lower",
6
+ title: "title",
7
+ fold: "fold",
8
+ simple: "simple",
9
+ lower_simple: "lower_simple",
10
+ title_simple: "title_simple",
11
+ fold_simple: "fold_simple"
11
12
  };
12
- function a(e, p = r.fold) {
13
- return i(e, p);
13
+ function a(e, t = i.fold) {
14
+ return c(e, t);
14
15
  }
15
- function m(e) {
16
- return i(e, r.upper);
16
+ function o(e) {
17
+ return c(e, i.upper);
17
18
  }
18
- function u(e) {
19
- return i(e, r.title);
19
+ function s(e) {
20
+ return c(e, i.title);
20
21
  }
21
- function i(e, p) {
22
- switch (p) {
23
- case r.upper:
24
- return n(e);
25
- case r.lower:
26
- return s(e);
27
- case r.title:
28
- return e.replace(
29
- new RegExp("\\p{L}[\\p{L}\\p{M}\\p{N}]*", "gu"),
30
- (t) => t.charAt(0).toUpperCase() + t.slice(1).toLowerCase()
31
- );
32
- case r.fold:
33
- return e.normalize("NFKD").toLowerCase();
34
- case r.simple:
35
- return e.replace(/[^a-z0-9]+/g, " ").trim();
36
- case r.lower_simple:
37
- return l(e).replace(/[^a-z0-9]+/g, " ").trim();
38
- case r.title_simple:
39
- return e.split(/[^a-z0-9]+/g).map((t) => o(t)).join(" ");
40
- case r.fold_simple:
41
- return e.normalize("NFKD").toLowerCase().replace(/[^a-z0-9]+/g, " ").trim();
42
- }
22
+ function c(a, o) {
23
+ switch (o) {
24
+ case i.upper: return n(a);
25
+ case i.lower: return t(a);
26
+ case i.title: return a.replace(/\p{L}[\p{L}\p{M}\p{N}]*/gu, (e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase());
27
+ case i.fold: return a.normalize("NFKD").toLowerCase();
28
+ case i.simple: return a.replace(/[^a-z0-9]+/g, " ").trim();
29
+ case i.lower_simple: return e(a).replace(/[^a-z0-9]+/g, " ").trim();
30
+ case i.title_simple: return a.split(/[^a-z0-9]+/g).map((e) => r(e)).join(" ");
31
+ case i.fold_simple: return a.normalize("NFKD").toLowerCase().replace(/[^a-z0-9]+/g, " ").trim();
32
+ }
43
33
  }
44
- export {
45
- r as CaseTypes,
46
- a as convertCase,
47
- u as title,
48
- m as upper
49
- };
34
+ export { i as CaseTypes, a as convertCase, s as title, o as upper };
package/dist/index.js CHANGED
@@ -1,141 +1,14 @@
1
- import { ascii as t, slug as a } from "./ascii/index.js";
2
- import { bytesToBase64 as i, fromBase64 as o, toBase64 as n } from "./base64/index.js";
3
- import { CaseTypes as c, convertCase as d, title as p, upper as u } from "./convertcase/index.js";
4
- import { inlineMarkdown as f, markDownRenderer as h, markdown as g } from "./markdown/index.js";
5
- import { counted as U, inflector as w, isPlural as x, isSingular as b, matchCase as y, plural as C, pluralPascal as k, pluralStudly as R, singular as z, uncountable as A } from "./pluralizer/index.js";
6
- import { randomInt as q, randomString as B } from "./random/index.js";
7
- import { substr as v, substrCount as E, substrReplace as F } from "./replacer/index.js";
8
- import { after as N, afterLast as P, apa as T, before as D, beforeLast as I, between as J, betweenFirst as O, camel as j, camelCacheSize as G, charAt as H, chopEnd as K, chopStart as Q, contains as V, containsAll as X, createRandomStringsNormally as Y, createRandomStringsUsing as Z, createRandomStringsUsingSequence as _, deduplicate as $, doesntContain as ee, doesntEndWith as re, doesntStartWith as te, endsWith as ae, excerpt as se, finish as ie, flushCache as oe, headline as ne, initials as le, is as ce, isAscii as de, isJson as pe, isMatch as ue, isUrl as me, kebab as fe, lcfirst as he, length as ge, limit as Se, lower as Ue, makePad as we, mask as xe, match as be, matchAll as ye, numbers as Ce, padBoth as ke, padLeft as Re, padRight as ze, pascal as Ae, password as We, position as qe, random as Be, remove as Le, repeat as ve, replace as Ee, replaceArray as Fe, replaceEnd as Me, replaceFirst as Ne, replaceLast as Pe, replaceMatches as Te, replaceStart as De, resetFactoryState as Ie, reverse as Je, snake as Oe, snakeCacheSize as je, squish as Ge, start as He, startsWith as Ke, stripTags as Qe, studly as Ve, studlyCacheSize as Xe, swap as Ye, take as Ze, toStringOr as _e, ucfirst as $e, ucsplit as er, ucwords as rr, unwrap as tr, wordCount as ar, wordWrap as sr, words as ir, wrap as or } from "./str.js";
9
- import { Stringable as lr, of as cr, str as dr } from "./stringable/index.js";
10
- import { transliterate as ur } from "./transliterate/index.js";
11
- import { ltrim as fr, rtrim as hr, trim as gr } from "./trimmer/index.js";
12
- import { createUlidsNormally as Ur, createUlidsUsing as wr, createUlidsUsingSequence as xr, freezeUlids as br, isUlid as yr, ulid as Cr } from "./ulid/index.js";
13
- import { createUuidsNormally as Rr, createUuidsUsing as zr, createUuidsUsingSequence as Ar, freezeUuids as Wr, isUuid as qr, uuid as Br, uuid7 as Lr } from "./uuid/index.js";
14
- export {
15
- c as CaseTypes,
16
- lr as Stringable,
17
- N as after,
18
- P as afterLast,
19
- T as apa,
20
- t as ascii,
21
- D as before,
22
- I as beforeLast,
23
- J as between,
24
- O as betweenFirst,
25
- i as bytesToBase64,
26
- j as camel,
27
- G as camelCacheSize,
28
- H as charAt,
29
- K as chopEnd,
30
- Q as chopStart,
31
- V as contains,
32
- X as containsAll,
33
- d as convertCase,
34
- U as counted,
35
- Y as createRandomStringsNormally,
36
- Z as createRandomStringsUsing,
37
- _ as createRandomStringsUsingSequence,
38
- Ur as createUlidsNormally,
39
- wr as createUlidsUsing,
40
- xr as createUlidsUsingSequence,
41
- Rr as createUuidsNormally,
42
- zr as createUuidsUsing,
43
- Ar as createUuidsUsingSequence,
44
- $ as deduplicate,
45
- ee as doesntContain,
46
- re as doesntEndWith,
47
- te as doesntStartWith,
48
- ae as endsWith,
49
- se as excerpt,
50
- ie as finish,
51
- oe as flushCache,
52
- br as freezeUlids,
53
- Wr as freezeUuids,
54
- o as fromBase64,
55
- ne as headline,
56
- w as inflector,
57
- le as initials,
58
- f as inlineMarkdown,
59
- ce as is,
60
- de as isAscii,
61
- pe as isJson,
62
- ue as isMatch,
63
- x as isPlural,
64
- b as isSingular,
65
- yr as isUlid,
66
- me as isUrl,
67
- qr as isUuid,
68
- fe as kebab,
69
- he as lcfirst,
70
- ge as length,
71
- Se as limit,
72
- Ue as lower,
73
- fr as ltrim,
74
- we as makePad,
75
- h as markDownRenderer,
76
- g as markdown,
77
- xe as mask,
78
- be as match,
79
- ye as matchAll,
80
- y as matchCase,
81
- Ce as numbers,
82
- cr as of,
83
- ke as padBoth,
84
- Re as padLeft,
85
- ze as padRight,
86
- Ae as pascal,
87
- We as password,
88
- C as plural,
89
- k as pluralPascal,
90
- R as pluralStudly,
91
- qe as position,
92
- Be as random,
93
- q as randomInt,
94
- B as randomString,
95
- Le as remove,
96
- ve as repeat,
97
- Ee as replace,
98
- Fe as replaceArray,
99
- Me as replaceEnd,
100
- Ne as replaceFirst,
101
- Pe as replaceLast,
102
- Te as replaceMatches,
103
- De as replaceStart,
104
- Ie as resetFactoryState,
105
- Je as reverse,
106
- hr as rtrim,
107
- z as singular,
108
- a as slug,
109
- Oe as snake,
110
- je as snakeCacheSize,
111
- Ge as squish,
112
- He as start,
113
- Ke as startsWith,
114
- dr as str,
115
- Qe as stripTags,
116
- Ve as studly,
117
- Xe as studlyCacheSize,
118
- v as substr,
119
- E as substrCount,
120
- F as substrReplace,
121
- Ye as swap,
122
- Ze as take,
123
- p as title,
124
- n as toBase64,
125
- _e as toStringOr,
126
- ur as transliterate,
127
- gr as trim,
128
- $e as ucfirst,
129
- er as ucsplit,
130
- rr as ucwords,
131
- Cr as ulid,
132
- A as uncountable,
133
- tr as unwrap,
134
- u as upper,
135
- Br as uuid,
136
- Lr as uuid7,
137
- ar as wordCount,
138
- sr as wordWrap,
139
- ir as words,
140
- or as wrap
141
- };
1
+ import { CaseTypes as e, convertCase as t, title as n, upper as r } from "./convertcase/index.js";
2
+ import { bytesToBase64 as i, fromBase64 as a, toBase64 as o } from "./base64/index.js";
3
+ import { randomInt as s, randomString as c } from "./random/index.js";
4
+ import { substr as l, substrCount as u, substrReplace as d } from "./replacer/index.js";
5
+ import { ltrim as f, rtrim as p, trim as m } from "./trimmer/index.js";
6
+ import { createUlidsNormally as h, createUlidsUsing as g, createUlidsUsingSequence as _, freezeUlids as v, isUlid as y, ulid as b } from "./ulid/index.js";
7
+ import { createUuidsNormally as x, createUuidsUsing as S, createUuidsUsingSequence as C, freezeUuids as w, isUuid as T, uuid as E, uuid7 as D } from "./uuid/index.js";
8
+ import { after as O, afterLast as k, apa as A, before as j, beforeLast as M, between as N, betweenFirst as P, camel as F, camelCacheSize as I, charAt as L, chopEnd as R, chopStart as z, contains as B, containsAll as V, createRandomStringsNormally as H, createRandomStringsUsing as U, createRandomStringsUsingSequence as W, deduplicate as G, doesntContain as K, doesntEndWith as q, doesntStartWith as J, endsWith as Y, excerpt as X, finish as Z, flushCache as Q, headline as $, initials as ee, is as te, isAscii as ne, isJson as re, isMatch as ie, isUrl as ae, kebab as oe, lcfirst as se, length as ce, limit as le, lower as ue, makePad as de, mask as fe, match as pe, matchAll as me, numbers as he, padBoth as ge, padLeft as _e, padRight as ve, pascal as ye, password as be, position as xe, random as Se, remove as Ce, repeat as we, replace as Te, replaceArray as Ee, replaceEnd as De, replaceFirst as Oe, replaceLast as ke, replaceMatches as Ae, replaceStart as je, resetFactoryState as Me, reverse as Ne, snake as Pe, snakeCacheSize as Fe, squish as Ie, start as Le, startsWith as Re, stripTags as ze, studly as Be, studlyCacheSize as Ve, swap as He, take as Ue, toStringOr as We, ucfirst as Ge, ucsplit as Ke, ucwords as qe, unwrap as Je, wordCount as Ye, wordWrap as Xe, words as Ze, wrap as Qe } from "./str.js";
9
+ import { ascii as $e, slug as et } from "./ascii/index.js";
10
+ import { inlineMarkdown as tt, markDownRenderer as nt, markdown as rt } from "./markdown/index.js";
11
+ import { counted as it, inflector as at, isPlural as ot, isSingular as st, matchCase as ct, plural as lt, pluralPascal as ut, pluralStudly as dt, singular as ft, uncountable as pt } from "./pluralizer/index.js";
12
+ import { transliterate as mt } from "./transliterate/index.js";
13
+ import { Stringable as ht, of as gt, str as _t } from "./stringable/index.js";
14
+ export { e as CaseTypes, ht as Stringable, O as after, k as afterLast, A as apa, $e as ascii, j as before, M as beforeLast, N as between, P as betweenFirst, i as bytesToBase64, F as camel, I as camelCacheSize, L as charAt, R as chopEnd, z as chopStart, B as contains, V as containsAll, t as convertCase, it as counted, H as createRandomStringsNormally, U as createRandomStringsUsing, W as createRandomStringsUsingSequence, h as createUlidsNormally, g as createUlidsUsing, _ as createUlidsUsingSequence, x as createUuidsNormally, S as createUuidsUsing, C as createUuidsUsingSequence, G as deduplicate, K as doesntContain, q as doesntEndWith, J as doesntStartWith, Y as endsWith, X as excerpt, Z as finish, Q as flushCache, v as freezeUlids, w as freezeUuids, a as fromBase64, $ as headline, at as inflector, ee as initials, tt as inlineMarkdown, te as is, ne as isAscii, re as isJson, ie as isMatch, ot as isPlural, st as isSingular, y as isUlid, ae as isUrl, T as isUuid, oe as kebab, se as lcfirst, ce as length, le as limit, ue as lower, f as ltrim, de as makePad, nt as markDownRenderer, rt as markdown, fe as mask, pe as match, me as matchAll, ct as matchCase, he as numbers, gt as of, ge as padBoth, _e as padLeft, ve as padRight, ye as pascal, be as password, lt as plural, ut as pluralPascal, dt as pluralStudly, xe as position, Se as random, s as randomInt, c as randomString, Ce as remove, we as repeat, Te as replace, Ee as replaceArray, De as replaceEnd, Oe as replaceFirst, ke as replaceLast, Ae as replaceMatches, je as replaceStart, Me as resetFactoryState, Ne as reverse, p as rtrim, ft as singular, et as slug, Pe as snake, Fe as snakeCacheSize, Ie as squish, Le as start, Re as startsWith, _t as str, ze as stripTags, Be as studly, Ve as studlyCacheSize, l as substr, u as substrCount, d as substrReplace, He as swap, Ue as take, n as title, o as toBase64, We as toStringOr, mt as transliterate, m as trim, Ge as ucfirst, Ke as ucsplit, qe as ucwords, b as ulid, pt as uncountable, Je as unwrap, r as upper, E as uuid, D as uuid7, Ye as wordCount, Xe as wordWrap, Ze as words, Qe as wrap };
@@ -1,34 +1,32 @@
1
- import { isArray as d } from "@tolki/utils";
2
- import p from "markdown-it";
3
- import w from "markdown-it-anchor";
4
- import b from "markdown-it-task-lists";
5
- function A(r, n = { gfm: !0, anchors: !1 }, t = []) {
6
- return r === null ? "" : i(n, t).render(r);
1
+ import { isArray as e } from "@tolki/utils";
2
+ import t from "markdown-it";
3
+ import n from "markdown-it-anchor";
4
+ import r from "markdown-it-task-lists";
5
+ // src/markdown/index.ts
6
+ function i(e, t = {
7
+ gfm: !0,
8
+ anchors: !1
9
+ }, n = []) {
10
+ return e === null ? "" : o(t, n).render(e);
7
11
  }
8
- function L(r, n = { gfm: !0 }, t = []) {
9
- return r === null ? "" : i(n, t).renderInline(r);
12
+ function a(e, t = { gfm: !0 }, n = []) {
13
+ return e === null ? "" : o(t, n).renderInline(e);
10
14
  }
11
- function i(r, n) {
12
- const {
13
- html: t = !1,
14
- linkify: s = !0,
15
- breaks: u = !0,
16
- gfm: a = !0,
17
- anchors: o = !1,
18
- allowUnsafeLinks: l = !1,
19
- ...m
20
- } = r, e = new p({ html: t, linkify: s, breaks: u, ...m });
21
- l && (e.validateLink = () => !0), a && e.use(b, { label: !0, labelAfter: !0 }), o && e.use(w, typeof o == "object" ? o : {});
22
- for (const f of n)
23
- if (d(f)) {
24
- const [c, k] = f;
25
- e.use(c, k);
26
- } else
27
- e.use(f);
28
- return e;
15
+ function o(i, a) {
16
+ let { html: o = !1, linkify: s = !0, breaks: c = !0, gfm: l = !0, anchors: u = !1, allowUnsafeLinks: d = !1, ...f } = i, p = new t({
17
+ html: o,
18
+ linkify: s,
19
+ breaks: c,
20
+ ...f
21
+ });
22
+ d && (p.validateLink = () => !0), l && p.use(r, {
23
+ label: !0,
24
+ labelAfter: !0
25
+ }), u && p.use(n, typeof u == "object" ? u : {});
26
+ for (let t of a) if (e(t)) {
27
+ let [e, n] = t;
28
+ p.use(e, n);
29
+ } else p.use(t);
30
+ return p;
29
31
  }
30
- export {
31
- L as inlineMarkdown,
32
- i as markDownRenderer,
33
- A as markdown
34
- };
32
+ export { a as inlineMarkdown, o as markDownRenderer, i as markdown };