@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.
@@ -6,9 +6,7 @@
6
6
  *
7
7
  * @requires {@link https://www.npmjs.com/package/any-ascii any-ascii package}
8
8
  *
9
- * @example
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;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD"}
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"}
@@ -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;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,CA0B1E;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,CAqB3E;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,CAyB3E"}
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"}
@@ -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
- * @requires {@link https://www.npmjs.com/package/ulid ulid package}
8
- *
9
- * @example
7
+ * @see https://tolki.abe.dev/strings/string-utilities-list.html#ulid
10
8
  *
11
- * ulid(); -> "01F8MECHZX2D7J8F8C8D4B8F8C"
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
- * @requires {@link https://www.npmjs.com/package/ulid ulid package}
20
- *
21
- * @example
17
+ * @see https://tolki.abe.dev/strings/string-utilities-list.html#ulid
22
18
  *
23
- * createUlidsNormally();
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
- * @requires {@link https://www.npmjs.com/package/ulid ulid package}
33
- *
34
- * @example
28
+ * @see https://tolki.abe.dev/strings/string-utilities-list.html#ulid
35
29
  *
36
- * createUlidsUsing(() => of("1234").toString());
30
+ * @requires {@link https://www.npmjs.com/package/ulid ulid package}
37
31
  */
38
- export declare function createUlidsUsing(factory?: (() => string) | null): void;
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
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ulid/index.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;GAWG;AACH,wBAAgB,IAAI,CAAC,IAAI,GAAE,IAAI,GAAG,MAAM,GAAG,IAAW,GAAG,MAAM,CAwB9D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,CAAC,MAAM,MAAM,CAAC,GAAG,IAAW,GAAG,IAAI,CAE5E;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"}
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"}
@@ -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 u(n = null) {
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 i(n = null) {
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 = u();
29
+ const f = i();
30
30
  return l = o, r++, f;
31
- }, i(function() {
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 = u();
37
- if (i(() => t), n !== null)
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
- i as createUlidsUsing,
53
+ u as createUlidsUsing,
54
54
  U as createUlidsUsingSequence,
55
55
  p as freezeUlids,
56
56
  y as isUlid,
57
- u as ulid
57
+ i as ulid
58
58
  };
@@ -3,11 +3,9 @@
3
3
  *
4
4
  * @return The generated UUID string.
5
5
  *
6
- * @requires {@link https://www.npmjs.com/package/uuid uuid package}
7
- *
8
- * @example
6
+ * @see https://tolki.abe.dev/strings/string-utilities-list.html#uuid
9
7
  *
10
- * uuid(); -> "550e8400-e29b-41d4-a716-446655440000"
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
- * @requires {@link https://www.npmjs.com/package/uuid uuid package}
19
- *
20
- * @example
16
+ * @see https://tolki.abe.dev/strings/string-utilities-list.html#uuid7
21
17
  *
22
- * uuid7(); -> "550e8400-e29b-41d4-a716-446655440000"
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
- * @requires {@link https://www.npmjs.com/package/uuid uuid package}
32
- *
33
- * @example
27
+ * @see https://tolki.abe.dev/strings/string-utilities-list.html#uuid
34
28
  *
35
- * createUuidsUsing(() => "custom-uuid");
29
+ * @requires {@link https://www.npmjs.com/package/uuid uuid package}
36
30
  */
37
- export declare function createUuidsUsing(factory?: (() => string) | null): void;
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
- * @requires {@link https://www.npmjs.com/package/uuid uuid package}
71
- *
72
- * @example
64
+ * @see https://tolki.abe.dev/strings/string-utilities-list.html#uuid
73
65
  *
74
- * createUuidsNormally();
66
+ * @requires {@link https://www.npmjs.com/package/uuid uuid package}
75
67
  */
76
68
  export declare function createUuidsNormally(): void;
77
69
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/uuid/index.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;GAUG;AACH,wBAAgB,IAAI,IAAI,MAAM,CAE7B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,IAAI,MAAM,CAE9B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,CAAC,MAAM,MAAM,CAAC,GAAG,IAAW,GAAG,IAAI,CAE5E;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;;;;;;;;;;GAUG;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"}
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"}
@@ -1,13 +1,13 @@
1
1
  import { isString as o } from "@tolki/utils";
2
- import { v4 as a, v7 as c, validate as d, NIL as s, MAX as U, version as m } from "uuid";
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() : a();
5
+ return u ? u() : U();
6
6
  }
7
7
  function g() {
8
- return u ? u() : c();
8
+ return u ? u() : m();
9
9
  }
10
- function e(n = null) {
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 && !d(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(
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() === s : t === "max" ? n.toLowerCase() === U : t < 1 || t > 8 ? !1 : m(n) === t;
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.1",
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/num": "^1.0.1",
30
- "@tolki/utils": "^1.0.0"
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",