@thi.ng/strings
Advanced tools
Comparing version 3.8.13 to 3.9.0
@@ -24,2 +24,5 @@ import type { FnS, Stringer } from "./api.js"; | ||
* | ||
* @remarks | ||
* See {@link snake} for alternative. | ||
* | ||
* @example | ||
@@ -29,5 +32,3 @@ * ```ts tangle:../export/kebab.ts | ||
* | ||
* console.log( | ||
* kebab("FooBar23Baz") | ||
* ); | ||
* console.log(kebab("FooBar23Baz")); | ||
* // "foo-bar23-baz" | ||
@@ -43,2 +44,13 @@ * ``` | ||
* | ||
* @remarks | ||
* Also see {@link upperSnake} for alternative. | ||
* | ||
* @example | ||
* ```ts tangle:../export/snake.ts | ||
* import { snake } from "@thi.ng/strings"; | ||
* | ||
* console.log(snake("FooBar23Baz")); | ||
* // "foo_bar23_baz" | ||
* ``` | ||
* | ||
* @param x - | ||
@@ -50,2 +62,5 @@ */ | ||
* | ||
* @remarks | ||
* Also see {@link snake} for alternative. | ||
* | ||
* @param x - | ||
@@ -55,5 +70,19 @@ */ | ||
/** | ||
* Converts a kebab-case or snake_case string into CamelCase. Uses `-` | ||
* as default delimiter. | ||
* Converts a kebab-case or snake_case string into camelCase. Uses `-` as | ||
* default delimiter. | ||
* | ||
* @remarks | ||
* Alse see {@link pascal} for alternative. | ||
* | ||
* @example | ||
* ```ts tangle:../export/camel.ts | ||
* import { camel } from "@thi.ng/strings"; | ||
* | ||
* console.log(camel("foo-bar23-baz")); | ||
* // fooBar23Baz | ||
* | ||
* console.log(camel("FOO_BAR23_BAZ", "_")); | ||
* // fooBar23Baz | ||
* ``` | ||
* | ||
* @param x - | ||
@@ -63,2 +92,21 @@ * @param delim - | ||
export declare const camel: Stringer<string>; | ||
/** | ||
* Converts a kebab-case or snake_case string into PascalCase. Uses `-` as | ||
* default delimiter. | ||
* | ||
* @example | ||
* ```ts tangle:../export/pascal.ts | ||
* import { pascal } from "@thi.ng/strings"; | ||
* | ||
* console.log(pascal("foo-bar23-baz")); | ||
* // FooBar23Baz | ||
* | ||
* console.log(pascal("FOO_BAR23_BAZ", "_")); | ||
* // FooBar23Baz | ||
* ``` | ||
* | ||
* @param x | ||
* @param delim | ||
*/ | ||
export declare const pascal: Stringer<string>; | ||
//# sourceMappingURL=case.d.ts.map |
@@ -16,2 +16,3 @@ const upper = (x) => x.toUpperCase(); | ||
const camel = (x, delim = "-") => lower(x).replace(new RegExp(`\\${delim}+(\\w)`, "g"), (_, c) => upper(c)); | ||
const pascal = (x, delim = "-") => capitalize(camel(x, delim)); | ||
export { | ||
@@ -22,2 +23,3 @@ camel, | ||
lower, | ||
pascal, | ||
snake, | ||
@@ -24,0 +26,0 @@ upper, |
# Change Log | ||
- **Last updated**: 2024-12-27T14:11:37Z | ||
- **Last updated**: 2025-01-04T21:07:38Z | ||
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub) | ||
@@ -12,2 +12,8 @@ | ||
## [3.9.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@3.9.0) (2025-01-04) | ||
#### 🚀 Features | ||
- add `pascal()` case conversion ([2c3f4f4](https://github.com/thi-ng/umbrella/commit/2c3f4f4)) | ||
### [3.8.7](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@3.8.7) (2024-10-31) | ||
@@ -14,0 +20,0 @@ |
{ | ||
"name": "@thi.ng/strings", | ||
"version": "3.8.13", | ||
"version": "3.9.0", | ||
"description": "Various string formatting & utility functions", | ||
@@ -43,6 +43,6 @@ "type": "module", | ||
"dependencies": { | ||
"@thi.ng/api": "^8.11.15", | ||
"@thi.ng/errors": "^2.5.21", | ||
"@thi.ng/hex": "^2.3.59", | ||
"@thi.ng/memoize": "^4.0.5" | ||
"@thi.ng/api": "^8.11.16", | ||
"@thi.ng/errors": "^2.5.22", | ||
"@thi.ng/hex": "^2.3.60", | ||
"@thi.ng/memoize": "^4.0.6" | ||
}, | ||
@@ -216,3 +216,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "48bf4c22bf23f88ac99f435106af2214f79a0be1\n" | ||
"gitHead": "56c1d57a96565bbcc8c06c73779a619bba0db368\n" | ||
} |
@@ -154,3 +154,3 @@ <!-- This file is generated - DO NOT EDIT! --> | ||
Package sizes (brotli'd, pre-treeshake): ESM: 5.52 KB | ||
Package sizes (brotli'd, pre-treeshake): ESM: 5.51 KB | ||
@@ -227,2 +227,2 @@ ## Dependencies | ||
© 2015 - 2024 Karsten Schmidt // Apache License 2.0 | ||
© 2015 - 2025 Karsten Schmidt // Apache License 2.0 |
103086
2179
+ Added@thi.ng/api@8.11.17(transitive)
+ Added@thi.ng/errors@2.5.23(transitive)
+ Added@thi.ng/hex@2.3.61(transitive)
+ Added@thi.ng/memoize@4.0.7(transitive)
- Removed@thi.ng/api@8.11.16(transitive)
- Removed@thi.ng/errors@2.5.22(transitive)
- Removed@thi.ng/hex@2.3.60(transitive)
- Removed@thi.ng/memoize@4.0.6(transitive)
Updated@thi.ng/api@^8.11.16
Updated@thi.ng/errors@^2.5.22
Updated@thi.ng/hex@^2.3.60
Updated@thi.ng/memoize@^4.0.6