@thi.ng/strings 3.7.17 → 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/package.json +2 -2
- package/stringify.d.ts +19 -4
package/CHANGELOG.md
CHANGED
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",
|
|
@@ -203,5 +203,5 @@
|
|
|
203
203
|
"thi.ng": {
|
|
204
204
|
"year": 2015
|
|
205
205
|
},
|
|
206
|
-
"gitHead": "
|
|
206
|
+
"gitHead": "190d68e7f7524631b333cfdbf32c6a23be27c166\n"
|
|
207
207
|
}
|
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 -
|