@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 +1 -1
- package/ansi.d.ts +2 -0
- package/case.d.ts +2 -0
- package/center.d.ts +14 -0
- package/cursor.d.ts +2 -0
- package/escape.d.ts +2 -0
- package/hollerith.d.ts +2 -0
- package/join.d.ts +4 -0
- package/package.json +4 -4
- package/ruler.d.ts +4 -0
- package/slugify.d.ts +4 -0
- package/stringify.d.ts +19 -4
- package/tabs.d.ts +2 -0
- package/trim.d.ts +2 -0
package/CHANGELOG.md
CHANGED
package/ansi.d.ts
CHANGED
package/case.d.ts
CHANGED
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
package/escape.d.ts
CHANGED
package/hollerith.d.ts
CHANGED
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.
|
|
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.
|
|
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.
|
|
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": "
|
|
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
|
|
4
|
-
* and numbers differently.
|
|
5
|
-
*
|
|
6
|
-
* for `JSON.stringify(x,
|
|
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