@thi.ng/strings 3.7.16 → 3.7.18

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-02-22T11:59:16Z
3
+ - **Last updated**: 2024-02-28T14:23:30Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
package/ansi.d.ts CHANGED
@@ -3,6 +3,8 @@
3
3
  *
4
4
  * @example
5
5
  * ```ts
6
+ * import { stripAnsi } from "@thi.ng/strings";
7
+ *
6
8
  * stripAnsi("\x1B[32mhello\x1B[0m \x1B[91mworld\x1B[0m!"");
7
9
  * // 'hello world!'
8
10
  * ```
package/case.d.ts CHANGED
@@ -23,6 +23,8 @@ export declare const capitalize: FnS;
23
23
  *
24
24
  * @example
25
25
  * ```ts
26
+ * import { kebab } from "@thi.ng/strings";
27
+ *
26
28
  * kebab("FooBar23Baz");
27
29
  * // "foo-bar23-baz"
28
30
  * ```
package/center.d.ts CHANGED
@@ -11,10 +11,24 @@ import type { Stringer } from "./api.js";
11
11
  *
12
12
  * @example
13
13
  * ```ts
14
+ * import { center, wrap } from "@thi.ng/strings";
15
+ *
14
16
  * center(20, "<>")(wrap(" ")("thi.ng"))
15
17
  * // "<><><> thi.ng <><><>"
16
18
  * ```
17
19
  *
20
+ * @example
21
+ * ```ts
22
+ * import { comp } from "@thi.ng/compose";
23
+ * import { center, wrap } from "@thi.ng/strings";
24
+ *
25
+ * // compose formatting function
26
+ * const fmt = comp(center(20,"<>"), wrap(" "));
27
+ *
28
+ * fmt("thi.ng")
29
+ * // "<><><> thi.ng <><><>"
30
+ * ```
31
+ *
18
32
  * @param lineWidth - target length
19
33
  * @param pad - pad character(s)
20
34
  */
package/cursor.d.ts CHANGED
@@ -9,6 +9,8 @@
9
9
  *
10
10
  * @example
11
11
  * ```ts
12
+ * import { computeCursorPos } from "@thi.ng/strings";
13
+ *
12
14
  * computeCursorPos("thi.ng\numbrella", 10);
13
15
  * // [ 2, 4 ]
14
16
  *
package/escape.d.ts CHANGED
@@ -27,6 +27,8 @@ export declare const escape: (src: string) => string;
27
27
  *
28
28
  * @example
29
29
  * ```ts
30
+ * import { unescape } from "@thi.ng/strings";
31
+ *
30
32
  * unescape("\\ud83d\\ude0e \\U0001f60e")
31
33
  * // '😎'
32
34
  * ```
package/hollerith.d.ts CHANGED
@@ -4,6 +4,8 @@ import type { Stringer } from "./api.js";
4
4
  *
5
5
  * @example
6
6
  * ```ts
7
+ * import { hstr } from "@thi.ng/strings";
8
+ *
7
9
  * hstr("abc") // "3Habc"
8
10
  * hstr(123.45) // "6H123.45"
9
11
  * hstr("") // "0H"
package/join.d.ts CHANGED
@@ -6,11 +6,15 @@ import type { Stringer } from "./api.js";
6
6
  *
7
7
  * @example
8
8
  * ```ts
9
+ * import { format, join } from "@thi.ng/strings";
10
+ * import { partial } from "@thi.ng/compose";
11
+ *
9
12
  * const slashes = join("/");
10
13
  *
11
14
  * slashes([1, 2, 3]);
12
15
  * // "1/2/3"
13
16
  *
17
+ * // pre-compose formatter function w/ partial arguments
14
18
  * const formatOBJFace = partial(
15
19
  * format, ["f ", slashes, " ", slashes, " ", slashes]
16
20
  * );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/strings",
3
- "version": "3.7.16",
3
+ "version": "3.7.18",
4
4
  "description": "Various string formatting & utility functions",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -35,10 +35,10 @@
35
35
  "test": "bun test"
36
36
  },
37
37
  "dependencies": {
38
- "@thi.ng/api": "^8.9.25",
38
+ "@thi.ng/api": "^8.9.26",
39
39
  "@thi.ng/errors": "^2.4.18",
40
40
  "@thi.ng/hex": "^2.3.37",
41
- "@thi.ng/memoize": "^3.1.59"
41
+ "@thi.ng/memoize": "^3.1.60"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@microsoft/api-extractor": "^7.40.1",
@@ -203,5 +203,5 @@
203
203
  "thi.ng": {
204
204
  "year": 2015
205
205
  },
206
- "gitHead": "4513a1c703bdbf0f0867f03e547e47692e415fac\n"
206
+ "gitHead": "190d68e7f7524631b333cfdbf32c6a23be27c166\n"
207
207
  }
package/ruler.d.ts CHANGED
@@ -4,6 +4,8 @@
4
4
  *
5
5
  * @example
6
6
  * ```ts
7
+ * import { ruler } from "@thi.ng/strings";
8
+ *
7
9
  * console.log(ruler(40))
8
10
  * // |''''|''''|''''|''''|''''|''''|''''|''''
9
11
  *
@@ -23,6 +25,8 @@ export declare const ruler: (width: number, major?: number, a?: string, b?: stri
23
25
  *
24
26
  * @example
25
27
  * ```ts
28
+ * import { grid } from "@thi.ng/strings";
29
+ *
26
30
  * console.log(grid(3, 3, 4, 2));
27
31
  * // +---+---+---+
28
32
  * // | | | |
package/slugify.d.ts CHANGED
@@ -5,6 +5,8 @@ import type { Stringer } from "./api.js";
5
5
  *
6
6
  * @example
7
7
  * ```ts
8
+ * import { slugify } from "@thi.ng/strings";
9
+ *
8
10
  * slugify("Me, myself (& ëye) 😀!")
9
11
  * // "me-myself-and-eye"
10
12
  * ```
@@ -18,6 +20,8 @@ export declare const slugify: Stringer<string>;
18
20
  *
19
21
  * @example
20
22
  * ```ts
23
+ * import { slugifyGH } from "@thi.ng/strings";
24
+ *
21
25
  * slugifyGH("Me, myself (& ëye) 😀!")
22
26
  * // "me-myself--ëye-"
23
27
  * ```
package/stringify.d.ts CHANGED
@@ -1,9 +1,24 @@
1
1
  import type { Stringer } from "./api.js";
2
2
  /**
3
- * Higher order version of `JSON.stringify()` with the option to treat strings
4
- * and numbers differently. If `all` is `false` (default), strings and numbers
5
- * are simply converted using `String(x)`. If `indent` is given, it will be used
6
- * for `JSON.stringify(x, null, indent)`
3
+ * Higher order version of `JSON.stringify()` with the option to treat top-level
4
+ * strings and numbers differently (i.e. NOT if they're nested values!). If
5
+ * `all` is `false` (default), strings and numbers are simply converted using
6
+ * `String(x)`. If `indent` is given, it will be used for `JSON.stringify(x,
7
+ * null, indent)`
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { stringify } from "@thi.ng/strings";
12
+ *
13
+ * stringify()("hello");
14
+ * // hello
15
+ *
16
+ * stringify(true)("hello");
17
+ * // "hello"
18
+ *
19
+ * stringify()({ a: "hello" })
20
+ * // { "a": "hello" }
21
+ * ```
7
22
  *
8
23
  * @param all -
9
24
  * @param indent -
package/tabs.d.ts CHANGED
@@ -3,6 +3,8 @@
3
3
  *
4
4
  * @example
5
5
  * ```ts
6
+ * import { tabsToSpaces } from "@thi.ng/strings";
7
+ *
6
8
  * console.log(
7
9
  * tabsToSpaces("0\t1\t2", 10)
8
10
  * + "\n" +
package/trim.d.ts CHANGED
@@ -5,6 +5,8 @@ import type { Stringer } from "./api.js";
5
5
  *
6
6
  * @example
7
7
  * ```ts
8
+ * import { trim } from "@thi.ng/strings";
9
+ *
8
10
  * trim()(" Hello ")
9
11
  * // "Hello"
10
12
  *