@zinaid/str 0.0.5 → 0.0.7

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.
Files changed (59) hide show
  1. package/dist/ascii/index.d.ts +14 -0
  2. package/dist/ascii/index.d.ts.map +1 -0
  3. package/dist/ascii/index.js +7 -0
  4. package/dist/base64/index.d.ts +23 -0
  5. package/dist/base64/index.d.ts.map +1 -0
  6. package/dist/base64/index.js +124 -0
  7. package/dist/{convertcase.d.ts → convertcase/index.d.ts} +11 -1
  8. package/dist/convertcase/index.d.ts.map +1 -0
  9. package/dist/index.d.ts +4 -0
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +136 -131
  12. package/dist/markdown/index.d.ts +49 -0
  13. package/dist/markdown/index.d.ts.map +1 -0
  14. package/dist/markdown/index.js +32 -0
  15. package/dist/pluralizer/index.d.ts +100 -0
  16. package/dist/pluralizer/index.d.ts.map +1 -0
  17. package/dist/{pluralizer.js → pluralizer/index.js} +39 -32
  18. package/dist/{random.d.ts → random/index.d.ts} +3 -3
  19. package/dist/random/index.d.ts.map +1 -0
  20. package/dist/{random.js → random/index.js} +2 -1
  21. package/dist/replacer/index.d.ts +31 -0
  22. package/dist/replacer/index.d.ts.map +1 -0
  23. package/dist/str.d.ts +308 -173
  24. package/dist/str.d.ts.map +1 -1
  25. package/dist/str.js +510 -661
  26. package/dist/stringable/index.d.ts +952 -0
  27. package/dist/stringable/index.d.ts.map +1 -0
  28. package/dist/{stringable.js → stringable/index.js} +400 -13
  29. package/dist/transliterate/index.d.ts +14 -0
  30. package/dist/transliterate/index.d.ts.map +1 -0
  31. package/dist/transliterate/index.js +7 -0
  32. package/dist/trimmer/index.d.ts +25 -0
  33. package/dist/trimmer/index.d.ts.map +1 -0
  34. package/dist/ulid/index.d.ts +79 -0
  35. package/dist/ulid/index.d.ts.map +1 -0
  36. package/dist/ulid/index.js +58 -0
  37. package/dist/uuid/index.d.ts +92 -0
  38. package/dist/uuid/index.d.ts.map +1 -0
  39. package/dist/uuid/index.js +50 -0
  40. package/package.json +78 -21
  41. package/dist/base64.d.ts +0 -7
  42. package/dist/base64.d.ts.map +0 -1
  43. package/dist/base64.js +0 -123
  44. package/dist/convertcase.d.ts.map +0 -1
  45. package/dist/markdown.d.ts +0 -26
  46. package/dist/markdown.d.ts.map +0 -1
  47. package/dist/markdown.js +0 -55
  48. package/dist/pluralizer.d.ts +0 -38
  49. package/dist/pluralizer.d.ts.map +0 -1
  50. package/dist/random.d.ts.map +0 -1
  51. package/dist/replacer.d.ts +0 -31
  52. package/dist/replacer.d.ts.map +0 -1
  53. package/dist/stringable.d.ts +0 -555
  54. package/dist/stringable.d.ts.map +0 -1
  55. package/dist/trimmer.d.ts +0 -4
  56. package/dist/trimmer.d.ts.map +0 -1
  57. /package/dist/{convertcase.js → convertcase/index.js} +0 -0
  58. /package/dist/{replacer.js → replacer/index.js} +0 -0
  59. /package/dist/{trimmer.js → trimmer/index.js} +0 -0
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Transliterate a UTF-8 value to ASCII.
3
+ *
4
+ * @param value The value to transliterate.
5
+ * @return The transliterated ASCII string.
6
+ *
7
+ * @requires {@link https://www.npmjs.com/package/transliteration transliteration package}
8
+ *
9
+ * @example
10
+ *
11
+ * ascii('Héllo Wörld'); -> 'Hello World'
12
+ */
13
+ export declare function ascii(value: string): string;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ascii/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3C"}
@@ -0,0 +1,7 @@
1
+ import { transliterate as t } from "transliteration";
2
+ function e(r) {
3
+ return t(r);
4
+ }
5
+ export {
6
+ e as ascii
7
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Convert the given string to Base64 encoding.
3
+ *
4
+ * @param value - The string to encode.
5
+ * @returns The Base64 encoded string.
6
+ */
7
+ export declare function toBase64(value: string): string;
8
+ /**
9
+ * Convert raw bytes to a Base64 string using the same fallbacks as toBase64.
10
+ *
11
+ * @param bytes - The bytes to encode.
12
+ * @returns The Base64 encoded string.
13
+ */
14
+ export declare function bytesToBase64(bytes: Uint8Array): string;
15
+ /**
16
+ * Decode the given Base64 encoded string.
17
+ *
18
+ * @param value - The Base64 encoded string to decode.
19
+ * @param strict - Whether to enforce strict Base64 validation.
20
+ * @returns The decoded string or false if decoding fails.
21
+ */
22
+ export declare function fromBase64(value: string, strict?: boolean): string | false;
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base64/index.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAgC9C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAsBvD;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACtB,KAAK,EAAE,MAAM,EACb,MAAM,GAAE,OAAe,GACxB,MAAM,GAAG,KAAK,CAqEhB"}
@@ -0,0 +1,124 @@
1
+ import { isFunction as l } from "@zinaid/utils";
2
+ function S(r) {
3
+ const o = h();
4
+ if (o.Buffer && l(o.Buffer.from))
5
+ return o.Buffer.from(r, "utf8").toString("base64");
6
+ if (l(o.btoa))
7
+ try {
8
+ const t = d(r);
9
+ return o.btoa(t);
10
+ } catch {
11
+ return o.btoa(r);
12
+ }
13
+ const e = d(r);
14
+ return p(e);
15
+ }
16
+ function T(r) {
17
+ const o = h();
18
+ if (o.Buffer && l(o.Buffer.from))
19
+ return o.Buffer.from(r).toString("base64");
20
+ let e = "";
21
+ for (let t = 0; t < r.length; t++)
22
+ e += String.fromCharCode(r[t]);
23
+ return l(o.btoa) ? o.btoa(e) : p(e);
24
+ }
25
+ function y(r, o = !1) {
26
+ const e = h();
27
+ let t = String(r);
28
+ if (o) {
29
+ const c = t.replace(/\s+/g, "");
30
+ if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(c))
31
+ return !1;
32
+ t = c;
33
+ } else
34
+ t = t.replace(/[^A-Za-z0-9+/=]/g, "");
35
+ if (e.Buffer && l(e.Buffer.from))
36
+ try {
37
+ return e.Buffer.from(t, "base64").toString("utf8");
38
+ } catch {
39
+ return !1;
40
+ }
41
+ if (l(e.atob))
42
+ try {
43
+ const c = e.atob(t);
44
+ if (typeof e.TextDecoder == "function") {
45
+ const f = new Uint8Array(c.length);
46
+ for (let a = 0; a < c.length; a++)
47
+ f[a] = c.charCodeAt(a);
48
+ return new e.TextDecoder("utf-8").decode(f);
49
+ }
50
+ let n = "";
51
+ for (let f = 0; f < c.length; f++)
52
+ n += "%" + c.charCodeAt(f).toString(16).padStart(2, "0");
53
+ return decodeURIComponent(n);
54
+ } catch {
55
+ return !1;
56
+ }
57
+ try {
58
+ const c = m(t);
59
+ return C(c);
60
+ } catch {
61
+ return !1;
62
+ }
63
+ }
64
+ function h() {
65
+ return globalThis;
66
+ }
67
+ function d(r) {
68
+ return encodeURIComponent(r).replace(
69
+ /%([0-9A-F]{2})/g,
70
+ (o, e) => String.fromCharCode(parseInt(e, 16))
71
+ );
72
+ }
73
+ function p(r) {
74
+ const o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
75
+ let e = "";
76
+ for (let t = 0; t < r.length; t += 3) {
77
+ const c = r.charCodeAt(t), n = r.charCodeAt(t + 1), f = r.charCodeAt(t + 2), a = (c ?? 0) << 16 | (n ?? 0) << 8 | (f ?? 0), i = a >> 18 & 63, s = a >> 12 & 63, u = a >> 6 & 63, g = a & 63;
78
+ isNaN(n) ? e += o.charAt(i) + o.charAt(s) + "==" : isNaN(f) ? e += o.charAt(i) + o.charAt(s) + o.charAt(u) + "=" : e += o.charAt(i) + o.charAt(s) + o.charAt(u) + o.charAt(g);
79
+ }
80
+ return e;
81
+ }
82
+ function m(r) {
83
+ const o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", e = /* @__PURE__ */ new Map();
84
+ for (let n = 0; n < o.length; n++)
85
+ e.set(o[n], n);
86
+ const t = r.replace(/=+$/g, ""), c = [];
87
+ for (let n = 0; n < t.length; n += 4) {
88
+ const f = e.has(t[n]) ? e.get(t[n]) : 64, a = e.has(t[n + 1]) ? e.get(t[n + 1]) : 64, i = e.has(t[n + 2]) ? e.get(t[n + 2]) : 64, s = e.has(t[n + 3]) ? e.get(t[n + 3]) : 64, u = f << 18 | a << 12 | (i & 63) << 6 | s & 63, g = u >> 16 & 255, b = u >> 8 & 255, A = u & 255;
89
+ c.push(g), i !== 64 && c.push(b), s !== 64 && c.push(A);
90
+ }
91
+ return c;
92
+ }
93
+ function C(r) {
94
+ const o = h();
95
+ if (typeof o.TextDecoder == "function")
96
+ return new o.TextDecoder("utf-8").decode(new Uint8Array(r));
97
+ let e = "";
98
+ for (let t = 0; t < r.length; ) {
99
+ const c = r[t++];
100
+ if (c < 128)
101
+ e += String.fromCharCode(c);
102
+ else if (c < 224) {
103
+ const n = r[t++];
104
+ e += String.fromCharCode((c & 31) << 6 | n & 63);
105
+ } else if (c < 240) {
106
+ const n = r[t++], f = r[t++];
107
+ e += String.fromCharCode(
108
+ (c & 15) << 12 | (n & 63) << 6 | f & 63
109
+ );
110
+ } else {
111
+ const n = r[t++], f = r[t++], a = r[t++], s = ((c & 7) << 18 | (n & 63) << 12 | (f & 63) << 6 | a & 63) - 65536;
112
+ e += String.fromCharCode(
113
+ 55296 + (s >> 10 & 1023),
114
+ 56320 + (s & 1023)
115
+ );
116
+ }
117
+ }
118
+ return e;
119
+ }
120
+ export {
121
+ T as bytesToBase64,
122
+ y as fromBase64,
123
+ S as toBase64
124
+ };
@@ -12,6 +12,10 @@ export type ConvertCaseMode = (typeof CaseTypes)[keyof typeof CaseTypes];
12
12
  /**
13
13
  * Convert the case of a string.
14
14
  *
15
+ * @param value - The string to convert.
16
+ * @param mode - The case conversion mode to apply. Defaults to 'fold'.
17
+ * @returns The converted string.
18
+ *
15
19
  * @example
16
20
  *
17
21
  * convertCase('hello', CaseTypes.upper); -> 'HELLO'
@@ -20,6 +24,9 @@ export declare function convertCase(value: string, mode?: ConvertCaseMode): stri
20
24
  /**
21
25
  * Convert the given string to upper-case.
22
26
  *
27
+ * @param value - The string to convert.
28
+ * @returns The upper-case string.
29
+ *
23
30
  * @example
24
31
  *
25
32
  * upper("foo bar baz"); -> "FOO BAR BAZ"
@@ -29,10 +36,13 @@ export declare function upper(value: string): string;
29
36
  /**
30
37
  * Convert the given string to proper case.
31
38
  *
39
+ * @param value - The string to convert.
40
+ * @returns The proper-case string.
41
+ *
32
42
  * @example
33
43
  *
34
44
  * title("foo bar baz"); -> "Foo Bar Baz"
35
45
  * title("foO bAr BaZ"); -> "Foo Bar Baz"
36
46
  */
37
47
  export declare function title(value: string): string;
38
- //# sourceMappingURL=convertcase.d.ts.map
48
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/convertcase/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;CASZ,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEzE;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CACvB,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,eAAgC,GACvC,MAAM,CAER;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3C"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './ascii';
1
2
  export * from './base64';
2
3
  export * from './convertcase';
3
4
  export * from './markdown';
@@ -6,5 +7,8 @@ export * from './random';
6
7
  export * from './replacer';
7
8
  export * from './str';
8
9
  export * from './stringable';
10
+ export * from './transliterate';
9
11
  export * from './trimmer';
12
+ export * from './ulid';
13
+ export * from './uuid';
10
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,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,WAAW,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"}
package/dist/index.js CHANGED
@@ -1,133 +1,138 @@
1
- import { bytesToBase64 as a, fromBase64 as t, toBase64 as s } from "./base64.js";
2
- import { CaseTypes as n, convertCase as o, title as l, upper as c } from "./convertcase.js";
3
- import { inlineMarkdown as p, markDownRenderer as u, markdown as m } from "./markdown.js";
4
- import { inflector as h, isPlural as g, isSingular as S, matchCase as U, plural as w, singular as b, uncountable as x } from "./pluralizer.js";
5
- import { randomInt as k, randomString as y } from "./random.js";
6
- import { substr as z, substrCount as A, substrReplace as W } from "./replacer.js";
7
- import { after as B, afterLast as L, apa as v, ascii as E, before as M, beforeLast as N, between as P, betweenFirst as T, camel as F, camelCacheSize as D, charAt as I, chopEnd as J, chopStart as O, contains as j, containsAll as G, createRandomStringsNormally as H, createRandomStringsUsing as K, createRandomStringsUsingSequence as Q, createUlidsNormally as V, createUlidsUsing as X, createUlidsUsingSequence as Y, createUuidsNormally as Z, createUuidsUsing as _, createUuidsUsingSequence as $, deduplicate as ee, doesntContain as re, doesntEndWith as ae, doesntStartWith as te, endsWith as se, excerpt as ie, finish as ne, flushCache as oe, freezeUlids as le, freezeUuids as ce, headline as de, is as pe, isAscii as ue, isJson as me, isMatch as fe, isUlid as he, isUrl as ge, isUuid as Se, kebab as Ue, lcfirst as we, length as be, limit as xe, lower as Ce, makePad as ke, mask as ye, match as Re, matchAll as ze, numbers as Ae, padBoth as We, padLeft as qe, padRight as Be, pascal as Le, password as ve, pluralPascal as Ee, pluralStudly as Me, position as Ne, random as Pe, remove as Te, repeat as Fe, replace as De, replaceArray as Ie, replaceEnd as Je, replaceFirst as Oe, replaceLast as je, replaceMatches as Ge, replaceStart as He, reverse as Ke, slug as Qe, snake as Ve, snakeCacheSize as Xe, squish as Ye, start as Ze, startsWith as _e, stripTags as $e, studly as er, studlyCacheSize as rr, swap as ar, take as tr, toStringOr as sr, transliterate as ir, ucfirst as nr, ucsplit as or, ucwords as lr, ulid as cr, unwrap as dr, uuid as pr, uuid7 as ur, wordCount as mr, wordWrap as fr, words as hr, wrap as gr } from "./str.js";
8
- import { Stringable as Ur, of as wr } from "./stringable.js";
9
- import { ltrim as xr, rtrim as Cr, trim as kr } from "./trimmer.js";
1
+ import { ascii as t } from "./ascii/index.js";
2
+ import { bytesToBase64 as s, fromBase64 as i, toBase64 as o } from "./base64/index.js";
3
+ import { CaseTypes as l, convertCase as c, title as p, upper as d } from "./convertcase/index.js";
4
+ import { inlineMarkdown as m, markDownRenderer as f, markdown as h } from "./markdown/index.js";
5
+ import { inflector as S, isPlural as U, isSingular as w, matchCase as x, plural as b, pluralPascal as C, pluralStudly as k, singular as y, uncountable as R } from "./pluralizer/index.js";
6
+ import { randomInt as A, randomString as W } from "./random/index.js";
7
+ import { substr as B, substrCount as L, substrReplace as v } from "./replacer/index.js";
8
+ import { after as M, afterLast as N, apa as P, before as T, beforeLast as F, between as D, betweenFirst as I, camel as J, camelCacheSize as O, charAt as j, chopEnd as G, chopStart as H, contains as K, containsAll as Q, createRandomStringsNormally as V, createRandomStringsUsing as X, createRandomStringsUsingSequence as Y, deduplicate as Z, doesntContain as _, doesntEndWith as $, doesntStartWith as ee, endsWith as re, excerpt as te, finish as ae, flushCache as se, headline as ie, is as oe, isAscii as ne, isJson as le, isMatch as ce, isUrl as pe, kebab as de, lcfirst as ue, length as me, limit as fe, lower as he, makePad as ge, mask as Se, match as Ue, matchAll as we, numbers as xe, padBoth as be, padLeft as Ce, padRight as ke, pascal as ye, password as Re, position as ze, random as Ae, remove as We, repeat as qe, replace as Be, replaceArray as Le, replaceEnd as ve, replaceFirst as Ee, replaceLast as Me, replaceMatches as Ne, replaceStart as Pe, reverse as Te, slug as Fe, snake as De, snakeCacheSize as Ie, squish as Je, start as Oe, startsWith as je, stripTags as Ge, studly as He, studlyCacheSize as Ke, swap as Qe, take as Ve, toStringOr as Xe, ucfirst as Ye, ucsplit as Ze, ucwords as _e, unwrap as $e, wordCount as er, wordWrap as rr, words as tr, wrap as ar } from "./str.js";
9
+ import { Stringable as ir, of as or, str as nr } from "./stringable/index.js";
10
+ import { transliterate as cr } from "./transliterate/index.js";
11
+ import { ltrim as dr, rtrim as ur, trim as mr } from "./trimmer/index.js";
12
+ import { createUlidsNormally as hr, createUlidsUsing as gr, createUlidsUsingSequence as Sr, freezeUlids as Ur, isUlid as wr, ulid as xr } from "./ulid/index.js";
13
+ import { createUuidsNormally as Cr, createUuidsUsing as kr, createUuidsUsingSequence as yr, freezeUuids as Rr, isUuid as zr, uuid as Ar, uuid7 as Wr } from "./uuid/index.js";
10
14
  export {
11
- n as CaseTypes,
12
- Ur as Stringable,
13
- B as after,
14
- L as afterLast,
15
- v as apa,
16
- E as ascii,
17
- M as before,
18
- N as beforeLast,
19
- P as between,
20
- T as betweenFirst,
21
- a as bytesToBase64,
22
- F as camel,
23
- D as camelCacheSize,
24
- I as charAt,
25
- J as chopEnd,
26
- O as chopStart,
27
- j as contains,
28
- G as containsAll,
29
- o as convertCase,
30
- H as createRandomStringsNormally,
31
- K as createRandomStringsUsing,
32
- Q as createRandomStringsUsingSequence,
33
- V as createUlidsNormally,
34
- X as createUlidsUsing,
35
- Y as createUlidsUsingSequence,
36
- Z as createUuidsNormally,
37
- _ as createUuidsUsing,
38
- $ as createUuidsUsingSequence,
39
- ee as deduplicate,
40
- re as doesntContain,
41
- ae as doesntEndWith,
42
- te as doesntStartWith,
43
- se as endsWith,
44
- ie as excerpt,
45
- ne as finish,
46
- oe as flushCache,
47
- le as freezeUlids,
48
- ce as freezeUuids,
49
- t as fromBase64,
50
- de as headline,
51
- h as inflector,
52
- p as inlineMarkdown,
53
- pe as is,
54
- ue as isAscii,
55
- me as isJson,
56
- fe as isMatch,
57
- g as isPlural,
58
- S as isSingular,
59
- he as isUlid,
60
- ge as isUrl,
61
- Se as isUuid,
62
- Ue as kebab,
63
- we as lcfirst,
64
- be as length,
65
- xe as limit,
66
- Ce as lower,
67
- xr as ltrim,
68
- ke as makePad,
69
- u as markDownRenderer,
70
- m as markdown,
71
- ye as mask,
72
- Re as match,
73
- ze as matchAll,
74
- U as matchCase,
75
- Ae as numbers,
76
- wr as of,
77
- We as padBoth,
78
- qe as padLeft,
79
- Be as padRight,
80
- Le as pascal,
81
- ve as password,
82
- w as plural,
83
- Ee as pluralPascal,
84
- Me as pluralStudly,
85
- Ne as position,
86
- Pe as random,
87
- k as randomInt,
88
- y as randomString,
89
- Te as remove,
90
- Fe as repeat,
91
- De as replace,
92
- Ie as replaceArray,
93
- Je as replaceEnd,
94
- Oe as replaceFirst,
95
- je as replaceLast,
96
- Ge as replaceMatches,
97
- He as replaceStart,
98
- Ke as reverse,
99
- Cr as rtrim,
100
- b as singular,
101
- Qe as slug,
102
- Ve as snake,
103
- Xe as snakeCacheSize,
104
- Ye as squish,
105
- Ze as start,
106
- _e as startsWith,
107
- $e as stripTags,
108
- er as studly,
109
- rr as studlyCacheSize,
110
- z as substr,
111
- A as substrCount,
112
- W as substrReplace,
113
- ar as swap,
114
- tr as take,
115
- l as title,
116
- s as toBase64,
117
- sr as toStringOr,
118
- ir as transliterate,
119
- kr as trim,
120
- nr as ucfirst,
121
- or as ucsplit,
122
- lr as ucwords,
123
- cr as ulid,
124
- x as uncountable,
125
- dr as unwrap,
126
- c as upper,
127
- pr as uuid,
128
- ur as uuid7,
129
- mr as wordCount,
130
- fr as wordWrap,
131
- hr as words,
132
- gr as wrap
15
+ l as CaseTypes,
16
+ ir as Stringable,
17
+ M as after,
18
+ N as afterLast,
19
+ P as apa,
20
+ t as ascii,
21
+ T as before,
22
+ F as beforeLast,
23
+ D as between,
24
+ I as betweenFirst,
25
+ s as bytesToBase64,
26
+ J as camel,
27
+ O as camelCacheSize,
28
+ j as charAt,
29
+ G as chopEnd,
30
+ H as chopStart,
31
+ K as contains,
32
+ Q as containsAll,
33
+ c as convertCase,
34
+ V as createRandomStringsNormally,
35
+ X as createRandomStringsUsing,
36
+ Y as createRandomStringsUsingSequence,
37
+ hr as createUlidsNormally,
38
+ gr as createUlidsUsing,
39
+ Sr as createUlidsUsingSequence,
40
+ Cr as createUuidsNormally,
41
+ kr as createUuidsUsing,
42
+ yr as createUuidsUsingSequence,
43
+ Z as deduplicate,
44
+ _ as doesntContain,
45
+ $ as doesntEndWith,
46
+ ee as doesntStartWith,
47
+ re as endsWith,
48
+ te as excerpt,
49
+ ae as finish,
50
+ se as flushCache,
51
+ Ur as freezeUlids,
52
+ Rr as freezeUuids,
53
+ i as fromBase64,
54
+ ie as headline,
55
+ S as inflector,
56
+ m as inlineMarkdown,
57
+ oe as is,
58
+ ne as isAscii,
59
+ le as isJson,
60
+ ce as isMatch,
61
+ U as isPlural,
62
+ w as isSingular,
63
+ wr as isUlid,
64
+ pe as isUrl,
65
+ zr as isUuid,
66
+ de as kebab,
67
+ ue as lcfirst,
68
+ me as length,
69
+ fe as limit,
70
+ he as lower,
71
+ dr as ltrim,
72
+ ge as makePad,
73
+ f as markDownRenderer,
74
+ h as markdown,
75
+ Se as mask,
76
+ Ue as match,
77
+ we as matchAll,
78
+ x as matchCase,
79
+ xe as numbers,
80
+ or as of,
81
+ be as padBoth,
82
+ Ce as padLeft,
83
+ ke as padRight,
84
+ ye as pascal,
85
+ Re as password,
86
+ b as plural,
87
+ C as pluralPascal,
88
+ k as pluralStudly,
89
+ ze as position,
90
+ Ae as random,
91
+ A as randomInt,
92
+ W as randomString,
93
+ We as remove,
94
+ qe as repeat,
95
+ Be as replace,
96
+ Le as replaceArray,
97
+ ve as replaceEnd,
98
+ Ee as replaceFirst,
99
+ Me as replaceLast,
100
+ Ne as replaceMatches,
101
+ Pe as replaceStart,
102
+ Te as reverse,
103
+ ur as rtrim,
104
+ y as singular,
105
+ Fe as slug,
106
+ De as snake,
107
+ Ie as snakeCacheSize,
108
+ Je as squish,
109
+ Oe as start,
110
+ je as startsWith,
111
+ nr as str,
112
+ Ge as stripTags,
113
+ He as studly,
114
+ Ke as studlyCacheSize,
115
+ B as substr,
116
+ L as substrCount,
117
+ v as substrReplace,
118
+ Qe as swap,
119
+ Ve as take,
120
+ p as title,
121
+ o as toBase64,
122
+ Xe as toStringOr,
123
+ cr as transliterate,
124
+ mr as trim,
125
+ Ye as ucfirst,
126
+ Ze as ucsplit,
127
+ _e as ucwords,
128
+ xr as ulid,
129
+ R as uncountable,
130
+ $e as unwrap,
131
+ d as upper,
132
+ Ar as uuid,
133
+ Wr as uuid7,
134
+ er as wordCount,
135
+ rr as wordWrap,
136
+ tr as words,
137
+ ar as wrap
133
138
  };
@@ -0,0 +1,49 @@
1
+ import { default as MarkdownIt, Options as MarkdownItOptions, PluginSimple, PluginWithOptions } from 'markdown-it';
2
+ export interface MarkDownOptions extends MarkdownItOptions {
3
+ gfm?: boolean;
4
+ anchors?: object | boolean;
5
+ typographer?: boolean;
6
+ }
7
+ export type MarkDownExtension = PluginSimple | PluginWithOptions<unknown> | [PluginWithOptions<unknown>, unknown];
8
+ export type MarkDownExtensions = MarkDownExtension[];
9
+ /**
10
+ * Converts GitHub flavored Markdown into HTML.
11
+ *
12
+ * @param value - The markdown string to convert.
13
+ * @param options - Options to customize the markdown rendering. Defaults to GFM enabled and no anchors.
14
+ * @param extensions - An array of markdown-it extensions to apply during rendering.
15
+ * @returns The resulting HTML string.
16
+ *
17
+ * @requires {@link https://www.npmjs.com/package/markdown-it markdown-it package}
18
+ *
19
+ * @example
20
+ *
21
+ * markdown('# Hello World'); -> '<h1>Hello World</h1>\n'
22
+ */
23
+ export declare function markdown(value: string, options?: MarkDownOptions, extensions?: MarkDownExtensions): string;
24
+ /**
25
+ * Converts inline Markdown into HTML.
26
+ *
27
+ * @param value - The inline markdown string to convert.
28
+ * @param options - Options to customize the markdown rendering. Defaults to GFM enabled.
29
+ * @param extensions - An array of markdown-it extensions to apply during rendering.
30
+ * @returns The resulting HTML string.
31
+ *
32
+ * @requires {@link https://www.npmjs.com/package/markdown-it markdown-it package}
33
+ *
34
+ * @example
35
+ *
36
+ * inlineMarkdown("Hello *World*"); -> "<p>Hello <em>World</em></p>"
37
+ */
38
+ export declare function inlineMarkdown(value: string, options?: MarkDownOptions, extensions?: MarkDownExtensions): string;
39
+ /**
40
+ * Creates and configures a MarkdownIt renderer with the specified options and extensions.
41
+ *
42
+ * @param options - Options to customize the markdown rendering. Defaults to GFM enabled and no anchors.
43
+ * @param extensions - An array of markdown-it extensions to apply during rendering.
44
+ * @returns A configured MarkdownIt instance.
45
+ *
46
+ * @requires {@link https://www.npmjs.com/package/markdown-it markdown-it package}
47
+ */
48
+ export declare function markDownRenderer(options?: MarkDownOptions, extensions?: MarkDownExtensions): MarkdownIt;
49
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/markdown/index.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,EAAE,EACf,KAAK,OAAO,IAAI,iBAAiB,EACjC,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACzB,MAAM,aAAa,CAAC;AAIrB,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACtD,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,MAAM,iBAAiB,GACvB,YAAY,GACZ,iBAAiB,CAAC,OAAO,CAAC,GAC1B,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;AAE5C,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,EAAE,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CACpB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,eAA+C,EACxD,UAAU,GAAE,kBAAuB,GACpC,MAAM,CAER;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC1B,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,eAA+B,EACxC,UAAU,GAAE,kBAAuB,GACpC,MAAM,CAER;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC5B,OAAO,GAAE,eAA+C,EACxD,UAAU,GAAE,kBAAuB,cAgCtC"}
@@ -0,0 +1,32 @@
1
+ import { isArray as d } from "@zinaid/utils";
2
+ import k from "markdown-it";
3
+ import p from "markdown-it-anchor";
4
+ import w from "markdown-it-task-lists";
5
+ function y(r, e = { gfm: !0, anchors: !1 }, t = []) {
6
+ return s(e, t).render(r);
7
+ }
8
+ function A(r, e = { gfm: !0 }, t = []) {
9
+ return s(e, t).renderInline(r);
10
+ }
11
+ function s(r = { gfm: !0, anchors: !1 }, e = []) {
12
+ const {
13
+ html: t = !1,
14
+ linkify: i = !0,
15
+ breaks: u = !0,
16
+ gfm: a = !0,
17
+ anchors: f = !1,
18
+ ...m
19
+ } = r, n = new k({ html: t, linkify: i, breaks: u, ...m });
20
+ a && n.use(w, { label: !0, labelAfter: !0 }), f && n.use(p, typeof f == "object" ? f : {});
21
+ for (const o of e)
22
+ if (d(o)) {
23
+ const [l, c] = o;
24
+ n.use(l, c);
25
+ } else o && n.use(o);
26
+ return n;
27
+ }
28
+ export {
29
+ A as inlineMarkdown,
30
+ s as markDownRenderer,
31
+ y as markdown
32
+ };