@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.
- package/dist/ascii/index.js +24 -39
- package/dist/base64/index.js +90 -118
- package/dist/convertcase/index.js +29 -44
- package/dist/index.js +14 -141
- package/dist/markdown/index.js +29 -31
- package/dist/pluralizer/index.js +30 -93
- package/dist/random/index.js +30 -42
- package/dist/replacer/index.js +39 -60
- package/dist/str.js +692 -1006
- package/dist/stringable/index.js +462 -1329
- package/dist/transliterate/index.js +5 -6
- package/dist/trimmer/index.js +83 -88
- package/dist/ulid/index.js +42 -52
- package/dist/uuid/index.js +33 -43
- package/package.json +35 -22
package/dist/ascii/index.js
CHANGED
|
@@ -1,41 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
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
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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 };
|
package/dist/base64/index.js
CHANGED
|
@@ -1,126 +1,98 @@
|
|
|
1
|
-
import { isFunction as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
|
65
|
-
|
|
52
|
+
function i() {
|
|
53
|
+
return globalThis;
|
|
66
54
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
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
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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 {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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,
|
|
13
|
-
|
|
13
|
+
function a(e, t = i.fold) {
|
|
14
|
+
return c(e, t);
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
16
|
+
function o(e) {
|
|
17
|
+
return c(e, i.upper);
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
19
|
+
function s(e) {
|
|
20
|
+
return c(e, i.title);
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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 {
|
|
2
|
-
import { bytesToBase64 as i, fromBase64 as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { after as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
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 };
|
package/dist/markdown/index.js
CHANGED
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
import { isArray as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
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
|
|
9
|
-
|
|
12
|
+
function a(e, t = { gfm: !0 }, n = []) {
|
|
13
|
+
return e === null ? "" : o(t, n).renderInline(e);
|
|
10
14
|
}
|
|
11
|
-
function i
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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 };
|