@thi.ng/strings 3.8.12 → 3.9.0
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 +7 -1
- package/README.md +3 -3
- package/case.d.ts +53 -5
- package/case.js +2 -0
- package/package.json +13 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**:
|
|
3
|
+
- **Last updated**: 2025-01-04T21:07:38Z
|
|
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.
|
|
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [3.9.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@3.9.0) (2025-01-04)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add `pascal()` case conversion ([2c3f4f4](https://github.com/thi-ng/umbrella/commit/2c3f4f4))
|
|
17
|
+
|
|
12
18
|
### [3.8.7](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@3.8.7) (2024-10-31)
|
|
13
19
|
|
|
14
20
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 200 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
|
@@ -151,7 +151,7 @@ For Node.js REPL:
|
|
|
151
151
|
const str = await import("@thi.ng/strings");
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 5.
|
|
154
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 5.51 KB
|
|
155
155
|
|
|
156
156
|
## Dependencies
|
|
157
157
|
|
|
@@ -223,4 +223,4 @@ If this project contributes to an academic publication, please cite it as:
|
|
|
223
223
|
|
|
224
224
|
## License
|
|
225
225
|
|
|
226
|
-
© 2015 -
|
|
226
|
+
© 2015 - 2025 Karsten Schmidt // Apache License 2.0
|
package/case.d.ts
CHANGED
|
@@ -21,13 +21,14 @@ export declare const capitalize: FnS;
|
|
|
21
21
|
* Converts a CamelCase string into kebab case, with optional custom
|
|
22
22
|
* delimiter (`-` by default).
|
|
23
23
|
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* See {@link snake} for alternative.
|
|
26
|
+
*
|
|
24
27
|
* @example
|
|
25
28
|
* ```ts tangle:../export/kebab.ts
|
|
26
29
|
* import { kebab } from "@thi.ng/strings";
|
|
27
30
|
*
|
|
28
|
-
* console.log(
|
|
29
|
-
* kebab("FooBar23Baz")
|
|
30
|
-
* );
|
|
31
|
+
* console.log(kebab("FooBar23Baz"));
|
|
31
32
|
* // "foo-bar23-baz"
|
|
32
33
|
* ```
|
|
33
34
|
*
|
|
@@ -38,21 +39,68 @@ export declare const kebab: Stringer<string>;
|
|
|
38
39
|
/**
|
|
39
40
|
* Short for {@link kebab} using `_` as delimiter.
|
|
40
41
|
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* Also see {@link upperSnake} for alternative.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts tangle:../export/snake.ts
|
|
47
|
+
* import { snake } from "@thi.ng/strings";
|
|
48
|
+
*
|
|
49
|
+
* console.log(snake("FooBar23Baz"));
|
|
50
|
+
* // "foo_bar23_baz"
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
41
53
|
* @param x -
|
|
42
54
|
*/
|
|
43
55
|
export declare const snake: FnS;
|
|
44
56
|
/**
|
|
45
57
|
* Uppercase version of {@link snake}.
|
|
46
58
|
*
|
|
59
|
+
* @remarks
|
|
60
|
+
* Also see {@link snake} for alternative.
|
|
61
|
+
*
|
|
47
62
|
* @param x -
|
|
48
63
|
*/
|
|
49
64
|
export declare const upperSnake: FnS;
|
|
50
65
|
/**
|
|
51
|
-
* Converts a kebab-case or snake_case string into
|
|
52
|
-
*
|
|
66
|
+
* Converts a kebab-case or snake_case string into camelCase. Uses `-` as
|
|
67
|
+
* default delimiter.
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* Alse see {@link pascal} for alternative.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts tangle:../export/camel.ts
|
|
74
|
+
* import { camel } from "@thi.ng/strings";
|
|
75
|
+
*
|
|
76
|
+
* console.log(camel("foo-bar23-baz"));
|
|
77
|
+
* // fooBar23Baz
|
|
78
|
+
*
|
|
79
|
+
* console.log(camel("FOO_BAR23_BAZ", "_"));
|
|
80
|
+
* // fooBar23Baz
|
|
81
|
+
* ```
|
|
53
82
|
*
|
|
54
83
|
* @param x -
|
|
55
84
|
* @param delim -
|
|
56
85
|
*/
|
|
57
86
|
export declare const camel: Stringer<string>;
|
|
87
|
+
/**
|
|
88
|
+
* Converts a kebab-case or snake_case string into PascalCase. Uses `-` as
|
|
89
|
+
* default delimiter.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts tangle:../export/pascal.ts
|
|
93
|
+
* import { pascal } from "@thi.ng/strings";
|
|
94
|
+
*
|
|
95
|
+
* console.log(pascal("foo-bar23-baz"));
|
|
96
|
+
* // FooBar23Baz
|
|
97
|
+
*
|
|
98
|
+
* console.log(pascal("FOO_BAR23_BAZ", "_"));
|
|
99
|
+
* // FooBar23Baz
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @param x
|
|
103
|
+
* @param delim
|
|
104
|
+
*/
|
|
105
|
+
export declare const pascal: Stringer<string>;
|
|
58
106
|
//# sourceMappingURL=case.d.ts.map
|
package/case.js
CHANGED
|
@@ -13,11 +13,13 @@ const kebab = (x, delim = "-") => lower(
|
|
|
13
13
|
const snake = (x) => kebab(x, "_");
|
|
14
14
|
const upperSnake = (x) => snake(x).toUpperCase();
|
|
15
15
|
const camel = (x, delim = "-") => lower(x).replace(new RegExp(`\\${delim}+(\\w)`, "g"), (_, c) => upper(c));
|
|
16
|
+
const pascal = (x, delim = "-") => capitalize(camel(x, delim));
|
|
16
17
|
export {
|
|
17
18
|
camel,
|
|
18
19
|
capitalize,
|
|
19
20
|
kebab,
|
|
20
21
|
lower,
|
|
22
|
+
pascal,
|
|
21
23
|
snake,
|
|
22
24
|
upper,
|
|
23
25
|
upperSnake
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/strings",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "Various string formatting & utility functions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
{
|
|
20
20
|
"type": "patreon",
|
|
21
21
|
"url": "https://patreon.com/thing_umbrella"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "liberapay",
|
|
25
|
+
"url": "https://liberapay.com/thi.ng"
|
|
22
26
|
}
|
|
23
27
|
],
|
|
24
28
|
"author": "Karsten Schmidt (https://thi.ng)",
|
|
@@ -36,15 +40,15 @@
|
|
|
36
40
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
41
|
},
|
|
38
42
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.11.
|
|
40
|
-
"@thi.ng/errors": "^2.5.
|
|
41
|
-
"@thi.ng/hex": "^2.3.
|
|
42
|
-
"@thi.ng/memoize": "^4.0.
|
|
43
|
+
"@thi.ng/api": "^8.11.16",
|
|
44
|
+
"@thi.ng/errors": "^2.5.22",
|
|
45
|
+
"@thi.ng/hex": "^2.3.60",
|
|
46
|
+
"@thi.ng/memoize": "^4.0.6"
|
|
43
47
|
},
|
|
44
48
|
"devDependencies": {
|
|
45
|
-
"@microsoft/api-extractor": "^7.48.
|
|
46
|
-
"esbuild": "^0.24.
|
|
47
|
-
"typedoc": "^0.27.
|
|
49
|
+
"@microsoft/api-extractor": "^7.48.1",
|
|
50
|
+
"esbuild": "^0.24.2",
|
|
51
|
+
"typedoc": "^0.27.6",
|
|
48
52
|
"typescript": "^5.7.2"
|
|
49
53
|
},
|
|
50
54
|
"keywords": [
|
|
@@ -208,5 +212,5 @@
|
|
|
208
212
|
"thi.ng": {
|
|
209
213
|
"year": 2015
|
|
210
214
|
},
|
|
211
|
-
"gitHead": "
|
|
215
|
+
"gitHead": "56c1d57a96565bbcc8c06c73779a619bba0db368\n"
|
|
212
216
|
}
|