@tolki/str 1.0.1 → 1.0.3
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.d.ts +2 -0
- package/dist/ascii/index.d.ts.map +1 -1
- package/dist/ascii/index.js +23 -28
- package/dist/base64/index.d.ts +2 -0
- package/dist/base64/index.d.ts.map +1 -1
- package/dist/convertcase/index.d.ts +2 -8
- package/dist/convertcase/index.d.ts.map +1 -1
- package/dist/markdown/index.d.ts +1 -1
- package/dist/markdown/index.d.ts.map +1 -1
- package/dist/markdown/index.js +12 -11
- package/dist/pluralizer/index.d.ts +8 -14
- package/dist/pluralizer/index.d.ts.map +1 -1
- package/dist/replacer/index.d.ts +8 -0
- package/dist/replacer/index.d.ts.map +1 -1
- package/dist/replacer/index.js +31 -27
- package/dist/str.d.ts +50 -136
- package/dist/str.d.ts.map +1 -1
- package/dist/str.js +371 -375
- package/dist/stringable/index.d.ts +5 -9
- package/dist/stringable/index.d.ts.map +1 -1
- package/dist/stringable/index.js +109 -118
- package/dist/transliterate/index.d.ts +1 -3
- package/dist/transliterate/index.d.ts.map +1 -1
- package/dist/trimmer/index.d.ts +6 -0
- package/dist/trimmer/index.d.ts.map +1 -1
- package/dist/ulid/index.d.ts +8 -14
- package/dist/ulid/index.d.ts.map +1 -1
- package/dist/ulid/index.js +8 -8
- package/dist/uuid/index.d.ts +9 -17
- package/dist/uuid/index.d.ts.map +1 -1
- package/dist/uuid/index.js +6 -6
- package/package.json +3 -3
|
@@ -6,9 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @requires {@link https://www.npmjs.com/package/any-ascii any-ascii package}
|
|
8
8
|
*
|
|
9
|
-
* @
|
|
10
|
-
*
|
|
11
|
-
* transliterate('ⓣⓔⓢⓣ@ⓛⓐⓡⓐⓥⓔⓛ.ⓒⓞⓜ'); -> 'test@laravel.com'
|
|
9
|
+
* @see https://tolki.abe.dev/strings/string-utilities-list.html#transliterate
|
|
12
10
|
*/
|
|
13
11
|
export declare function transliterate(value: string): string;
|
|
14
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transliterate/index.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transliterate/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
package/dist/trimmer/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* @param value - The string to trim.
|
|
5
5
|
* @param charlist - Optional list of characters to trim instead of whitespace.
|
|
6
6
|
* @returns The trimmed string.
|
|
7
|
+
*
|
|
8
|
+
* @see https://tolki.abe.dev/strings/string-utilities-list.html#trim
|
|
7
9
|
*/
|
|
8
10
|
export declare function trim(value: string, charlist?: string | null): string;
|
|
9
11
|
/**
|
|
@@ -12,6 +14,8 @@ export declare function trim(value: string, charlist?: string | null): string;
|
|
|
12
14
|
* @param value - The string to trim.
|
|
13
15
|
* @param charlist - Optional list of characters to trim instead of whitespace.
|
|
14
16
|
* @returns The left-trimmed string.
|
|
17
|
+
*
|
|
18
|
+
* @see https://tolki.abe.dev/strings/string-utilities-list.html#ltrim
|
|
15
19
|
*/
|
|
16
20
|
export declare function ltrim(value: string, charlist?: string | null): string;
|
|
17
21
|
/**
|
|
@@ -20,6 +24,8 @@ export declare function ltrim(value: string, charlist?: string | null): string;
|
|
|
20
24
|
* @param value - The string to trim.
|
|
21
25
|
* @param charlist - Optional list of characters to trim instead of whitespace.
|
|
22
26
|
* @returns The right-trimmed string.
|
|
27
|
+
*
|
|
28
|
+
* @see https://tolki.abe.dev/strings/string-utilities-list.html#rtrim
|
|
23
29
|
*/
|
|
24
30
|
export declare function rtrim(value: string, charlist?: string | null): string;
|
|
25
31
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/trimmer/index.ts"],"names":[],"mappings":"AAkEA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/trimmer/index.ts"],"names":[],"mappings":"AAkEA;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,CA0B1E;AAED;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,CAqB3E;AAED;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,CAyB3E"}
|
package/dist/ulid/index.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generate a ULID.
|
|
2
|
+
* Generate a ULID (Universally Unique Lexicographically Sortable Identifier).
|
|
3
3
|
*
|
|
4
4
|
* @param time - Optional time component as a Date or number of milliseconds since epoch.
|
|
5
5
|
* @returns The generated ULID string.
|
|
6
6
|
*
|
|
7
|
-
* @
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
7
|
+
* @see https://tolki.abe.dev/strings/string-utilities-list.html#ulid
|
|
10
8
|
*
|
|
11
|
-
* ulid
|
|
9
|
+
* @requires {@link https://www.npmjs.com/package/ulid ulid package}
|
|
12
10
|
*/
|
|
13
11
|
export declare function ulid(time?: Date | number | null): string;
|
|
14
12
|
/**
|
|
@@ -16,11 +14,9 @@ export declare function ulid(time?: Date | number | null): string;
|
|
|
16
14
|
*
|
|
17
15
|
* @returns void.
|
|
18
16
|
*
|
|
19
|
-
* @
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
17
|
+
* @see https://tolki.abe.dev/strings/string-utilities-list.html#ulid
|
|
22
18
|
*
|
|
23
|
-
*
|
|
19
|
+
* @requires {@link https://www.npmjs.com/package/ulid ulid package}
|
|
24
20
|
*/
|
|
25
21
|
export declare function createUlidsNormally(): void;
|
|
26
22
|
/**
|
|
@@ -29,13 +25,11 @@ export declare function createUlidsNormally(): void;
|
|
|
29
25
|
* @param factory - The callable ULID factory.
|
|
30
26
|
* @returns void.
|
|
31
27
|
*
|
|
32
|
-
* @
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
28
|
+
* @see https://tolki.abe.dev/strings/string-utilities-list.html#ulid
|
|
35
29
|
*
|
|
36
|
-
*
|
|
30
|
+
* @requires {@link https://www.npmjs.com/package/ulid ulid package}
|
|
37
31
|
*/
|
|
38
|
-
export declare function createUlidsUsing(factory
|
|
32
|
+
export declare function createUlidsUsing(factory: (() => string) | null): void;
|
|
39
33
|
/**
|
|
40
34
|
* Set the sequence that will be used to generate ULIDs.
|
|
41
35
|
*
|
package/dist/ulid/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ulid/index.ts"],"names":[],"mappings":"AAQA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ulid/index.ts"],"names":[],"mappings":"AAQA;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CAAC,IAAI,GAAE,IAAI,GAAG,MAAM,GAAG,IAAW,GAAG,MAAM,CAwB9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,CAAC,MAAM,MAAM,CAAC,GAAG,IAAI,GAAG,IAAI,CAErE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CACpC,QAAQ,EAAE,MAAM,EAAE,EAClB,WAAW,GAAE,CAAC,MAAM,MAAM,CAAC,GAAG,IAAW,GAC1C,IAAI,CAwBN;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CACvB,QAAQ,GAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,IAAW,GACpD,MAAM,CAcR;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQ9C"}
|
package/dist/ulid/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isString as c } from "@tolki/utils";
|
|
2
2
|
import { ulid as e } from "ulid";
|
|
3
3
|
let l = null;
|
|
4
|
-
function
|
|
4
|
+
function i(n = null) {
|
|
5
5
|
if (l)
|
|
6
6
|
return l();
|
|
7
7
|
if (n == null)
|
|
@@ -18,7 +18,7 @@ function u(n = null) {
|
|
|
18
18
|
function a() {
|
|
19
19
|
l = null;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function u(n) {
|
|
22
22
|
l = n;
|
|
23
23
|
}
|
|
24
24
|
function U(n, t = null) {
|
|
@@ -26,15 +26,15 @@ function U(n, t = null) {
|
|
|
26
26
|
t ??= function() {
|
|
27
27
|
const o = l;
|
|
28
28
|
l = null;
|
|
29
|
-
const f =
|
|
29
|
+
const f = i();
|
|
30
30
|
return l = o, r++, f;
|
|
31
|
-
},
|
|
31
|
+
}, u(function() {
|
|
32
32
|
return r < n.length ? n[r++] : t();
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
function p(n = null) {
|
|
36
|
-
const t =
|
|
37
|
-
if (
|
|
36
|
+
const t = i();
|
|
37
|
+
if (u(() => t), n !== null)
|
|
38
38
|
try {
|
|
39
39
|
n(t);
|
|
40
40
|
} finally {
|
|
@@ -50,9 +50,9 @@ function y(n) {
|
|
|
50
50
|
}
|
|
51
51
|
export {
|
|
52
52
|
a as createUlidsNormally,
|
|
53
|
-
|
|
53
|
+
u as createUlidsUsing,
|
|
54
54
|
U as createUlidsUsingSequence,
|
|
55
55
|
p as freezeUlids,
|
|
56
56
|
y as isUlid,
|
|
57
|
-
|
|
57
|
+
i as ulid
|
|
58
58
|
};
|
package/dist/uuid/index.d.ts
CHANGED
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @return The generated UUID string.
|
|
5
5
|
*
|
|
6
|
-
* @
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
6
|
+
* @see https://tolki.abe.dev/strings/string-utilities-list.html#uuid
|
|
9
7
|
*
|
|
10
|
-
* uuid
|
|
8
|
+
* @requires {@link https://www.npmjs.com/package/uuid uuid package}
|
|
11
9
|
*/
|
|
12
10
|
export declare function uuid(): string;
|
|
13
11
|
/**
|
|
@@ -15,11 +13,9 @@ export declare function uuid(): string;
|
|
|
15
13
|
*
|
|
16
14
|
* @return The generated UUID string.
|
|
17
15
|
*
|
|
18
|
-
* @
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
16
|
+
* @see https://tolki.abe.dev/strings/string-utilities-list.html#uuid7
|
|
21
17
|
*
|
|
22
|
-
*
|
|
18
|
+
* @requires {@link https://www.npmjs.com/package/uuid uuid package}
|
|
23
19
|
*/
|
|
24
20
|
export declare function uuid7(): string;
|
|
25
21
|
/**
|
|
@@ -28,13 +24,11 @@ export declare function uuid7(): string;
|
|
|
28
24
|
* @param factory - The callable UUID factory.
|
|
29
25
|
* @returns void.
|
|
30
26
|
*
|
|
31
|
-
* @
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
27
|
+
* @see https://tolki.abe.dev/strings/string-utilities-list.html#uuid
|
|
34
28
|
*
|
|
35
|
-
*
|
|
29
|
+
* @requires {@link https://www.npmjs.com/package/uuid uuid package}
|
|
36
30
|
*/
|
|
37
|
-
export declare function createUuidsUsing(factory
|
|
31
|
+
export declare function createUuidsUsing(factory: (() => string) | null): void;
|
|
38
32
|
/**
|
|
39
33
|
* Set the sequence that will be used to generate UUIDs.
|
|
40
34
|
*
|
|
@@ -67,11 +61,9 @@ export declare function freezeUuids(callback?: ((value: string) => string) | nul
|
|
|
67
61
|
*
|
|
68
62
|
* @return void.
|
|
69
63
|
*
|
|
70
|
-
* @
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
64
|
+
* @see https://tolki.abe.dev/strings/string-utilities-list.html#uuid
|
|
73
65
|
*
|
|
74
|
-
*
|
|
66
|
+
* @requires {@link https://www.npmjs.com/package/uuid uuid package}
|
|
75
67
|
*/
|
|
76
68
|
export declare function createUuidsNormally(): void;
|
|
77
69
|
/**
|
package/dist/uuid/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/uuid/index.ts"],"names":[],"mappings":"AAeA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/uuid/index.ts"],"names":[],"mappings":"AAeA;;;;;;;;GAQG;AACH,wBAAgB,IAAI,IAAI,MAAM,CAE7B;AAED;;;;;;;;GAQG;AACH,wBAAgB,KAAK,IAAI,MAAM,CAE9B;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,CAAC,MAAM,MAAM,CAAC,GAAG,IAAI,GAAG,IAAI,CAErE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CACpC,QAAQ,EAAE,MAAM,EAAE,EAClB,WAAW,GAAE,CAAC,MAAM,MAAM,CAAC,GAAG,IAAW,GAC1C,IAAI,CAwBN;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CACvB,QAAQ,GAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,IAAW,GACpD,MAAM,CAcR;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAClB,KAAK,EAAE,MAAM,GAAG,OAAO,EACvB,OAAO,GAAE,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,IAAW,GAC9C,OAAO,CAkCT"}
|
package/dist/uuid/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { isString as o } from "@tolki/utils";
|
|
2
|
-
import {
|
|
2
|
+
import { validate as a, NIL as c, MAX as d, version as s, v4 as U, v7 as m } from "uuid";
|
|
3
3
|
let u = null;
|
|
4
4
|
function f() {
|
|
5
|
-
return u ? u() :
|
|
5
|
+
return u ? u() : U();
|
|
6
6
|
}
|
|
7
7
|
function g() {
|
|
8
|
-
return u ? u() :
|
|
8
|
+
return u ? u() : m();
|
|
9
9
|
}
|
|
10
|
-
function e(n
|
|
10
|
+
function e(n) {
|
|
11
11
|
u = n;
|
|
12
12
|
}
|
|
13
13
|
function p(n, t = null) {
|
|
@@ -35,9 +35,9 @@ function A() {
|
|
|
35
35
|
u = null;
|
|
36
36
|
}
|
|
37
37
|
function C(n, t = null) {
|
|
38
|
-
return !o(n) || t !== null && !
|
|
38
|
+
return !o(n) || t !== null && !a(n) ? !1 : t === null ? /^[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}$/.test(
|
|
39
39
|
n
|
|
40
|
-
) : t === 0 || t === "nil" ? n.toLowerCase() ===
|
|
40
|
+
) : t === 0 || t === "nil" ? n.toLowerCase() === c : t === "max" ? n.toLowerCase() === d : t < 1 || t > 8 ? !1 : s(n) === t;
|
|
41
41
|
}
|
|
42
42
|
export {
|
|
43
43
|
A as createUuidsNormally,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tolki/str",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
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",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
],
|
|
27
27
|
"sideEffects": false,
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@tolki/
|
|
30
|
-
"@tolki/
|
|
29
|
+
"@tolki/utils": "^1.0.0",
|
|
30
|
+
"@tolki/num": "^1.0.3"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/markdown-it": "^14.1.2",
|