nhb-toolbox 4.14.4 → 4.14.7
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 +5 -0
- package/dist/cjs/date/constants.js +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/string/case.js +189 -0
- package/dist/cjs/string/convert.js +3 -88
- package/dist/dts/date/constants.d.ts +1 -1
- package/dist/dts/date/constants.d.ts.map +1 -1
- package/dist/dts/index.d.ts +2 -1
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/string/case.d.ts +76 -0
- package/dist/dts/string/case.d.ts.map +1 -0
- package/dist/dts/string/convert.d.ts +2 -27
- package/dist/dts/string/convert.d.ts.map +1 -1
- package/dist/dts/string/types.d.ts +15 -0
- package/dist/dts/string/types.d.ts.map +1 -1
- package/dist/esm/date/constants.js +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/string/case.js +186 -0
- package/dist/esm/string/convert.js +3 -87
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,11 @@ All notable changes to the package will be documented here.
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
## [4.14.4-7] - 2025-08-13 - 2025-08-14
|
|
10
|
+
|
|
11
|
+
- **Updated** internal logic of `convertStringCase` utility, added new `options` parameter.
|
|
12
|
+
- **Fixed** multiple internal issues.
|
|
13
|
+
|
|
9
14
|
## [4.14.1-3] - 2025-08-11 - 2025-08-12
|
|
10
15
|
|
|
11
16
|
- **Updated** JSDoc, dev dependencies and **fixed** minor issues.
|
|
@@ -471,5 +471,5 @@ exports.ZODIAC_PRESETS = Object.freeze({
|
|
|
471
471
|
tropical: exports.WESTERN_ZODIAC_SIGNS,
|
|
472
472
|
sidereal: exports.VEDIC_ZODIAC_SIGNS,
|
|
473
473
|
});
|
|
474
|
-
/**
|
|
474
|
+
/** @internal Symbol for accessing Chronos internals (plugin author use only) */
|
|
475
475
|
exports.INTERNALS = Symbol('Internals');
|
package/dist/cjs/index.js
CHANGED
|
@@ -37,8 +37,9 @@ Object.defineProperty(exports, "isKebabCase", { enumerable: true, get: function
|
|
|
37
37
|
Object.defineProperty(exports, "isPalindrome", { enumerable: true, get: function () { return guards_1.isPalindrome; } });
|
|
38
38
|
Object.defineProperty(exports, "isPascalCase", { enumerable: true, get: function () { return guards_1.isPascalCase; } });
|
|
39
39
|
Object.defineProperty(exports, "isSnakeCase", { enumerable: true, get: function () { return guards_1.isSnakeCase; } });
|
|
40
|
+
var case_1 = require("./string/case");
|
|
41
|
+
Object.defineProperty(exports, "convertStringCase", { enumerable: true, get: function () { return case_1.convertStringCase; } });
|
|
40
42
|
var convert_1 = require("./string/convert");
|
|
41
|
-
Object.defineProperty(exports, "convertStringCase", { enumerable: true, get: function () { return convert_1.convertStringCase; } });
|
|
42
43
|
Object.defineProperty(exports, "extractEmails", { enumerable: true, get: function () { return convert_1.extractEmails; } });
|
|
43
44
|
Object.defineProperty(exports, "extractURLs", { enumerable: true, get: function () { return convert_1.extractURLs; } });
|
|
44
45
|
Object.defineProperty(exports, "formatNumberWithPluralUnit", { enumerable: true, get: function () { return convert_1.formatUnitWithPlural; } });
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertStringCase = convertStringCase;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
/**
|
|
6
|
+
* * Converts a string to a specified case format with advanced handling for word boundaries, punctuation, acronyms, and Unicode characters.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* - This function is Unicode-aware, treats non-alphanumeric characters (spaces, underscores, dots, slashes, etc.) as word boundaries, and optionally preserves internal acronyms.
|
|
10
|
+
* - `Title Case` formatting respects small words such as prepositions, articles, conjunctions, and auxiliary verbs (defined in `LOWERCASE`) — these are not capitalized unless they appear at the start or end of the string.
|
|
11
|
+
* - Leading and trailing punctuation (non-letter/number characters) is preserved in the result.
|
|
12
|
+
*
|
|
13
|
+
* @param value - The input string to convert. Can contain letters, numbers, punctuation,
|
|
14
|
+
* spaces, underscores, dashes, etc.
|
|
15
|
+
* @param format - The target case format:
|
|
16
|
+
* - `'camelCase'` → camelCase (e.g., `myVariableName`)
|
|
17
|
+
* - `'PascalCase'` → PascalCase (e.g., `MyVariableName`)
|
|
18
|
+
* - `'snake_case'` → snake_case (e.g., `my_variable_name`)
|
|
19
|
+
* - `'kebab-case'` → kebab-case (e.g., `my-variable-name`)
|
|
20
|
+
* - `'Title Case'` → Title Case (e.g., `My Variable Name`)
|
|
21
|
+
* - `'lowercase'` → all lowercase [ It is recommended to use built-in string method `string.toLowerCase()` ]
|
|
22
|
+
* - `'UPPERCASE'` → all uppercase [ It is recommended to use built-in string method `string.toUpperCase()` ]
|
|
23
|
+
* @param options - Optional configuration settings.
|
|
24
|
+
*
|
|
25
|
+
* @returns The converted string, with leading/trailing punctuation preserved.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // Basic usage
|
|
29
|
+
* convertStringCase('my-example_string', 'camelCase');
|
|
30
|
+
* // Returns: 'myExampleString'
|
|
31
|
+
*
|
|
32
|
+
* convertStringCase('my-example_string', 'snake_case');
|
|
33
|
+
* // Returns: 'my_example_string'
|
|
34
|
+
*
|
|
35
|
+
* convertStringCase('my-example_string', 'kebab-case');
|
|
36
|
+
* // Returns: 'my-example-string'
|
|
37
|
+
*
|
|
38
|
+
* convertStringCase('my example string', 'Title Case');
|
|
39
|
+
* // Returns: 'My Example String'
|
|
40
|
+
*
|
|
41
|
+
* convertStringCase('My example String', 'lowercase');
|
|
42
|
+
* // Returns: 'my example string'
|
|
43
|
+
*
|
|
44
|
+
* convertStringCase('my example string', 'UPPERCASE');
|
|
45
|
+
* // Returns: 'MY EXAMPLE STRING'
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* // Preserve acronyms
|
|
49
|
+
* convertStringCase('get API response', 'camelCase', { preserveAcronyms: true });
|
|
50
|
+
* // Returns: 'getAPIResponse'
|
|
51
|
+
*
|
|
52
|
+
* convertStringCase('get API response', 'PascalCase', { preserveAcronyms: true });
|
|
53
|
+
* // Returns: 'GetAPIResponse'
|
|
54
|
+
*
|
|
55
|
+
* convertStringCase('the API of things', 'Title Case', { preserveAcronyms: true });
|
|
56
|
+
* // Returns: 'The API of Things'
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* // Leading/trailing punctuation is preserved
|
|
60
|
+
* convertStringCase('++hello_world++', 'PascalCase');
|
|
61
|
+
* // Returns: '++HelloWorld++'
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* // Dashes are preserved in Title Case
|
|
65
|
+
* convertStringCase('xml-http_request', 'Title Case');
|
|
66
|
+
* // Returns: 'Xml-http Request'
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* // Empty string returns empty
|
|
70
|
+
* convertStringCase('', 'camelCase');
|
|
71
|
+
* // Returns: ''
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* // Single token is capitalized properly
|
|
75
|
+
* convertStringCase('api', 'PascalCase');
|
|
76
|
+
* // Returns: 'Api'
|
|
77
|
+
*/
|
|
78
|
+
function convertStringCase(value, format, options) {
|
|
79
|
+
if (!value || typeof value !== 'string')
|
|
80
|
+
return '';
|
|
81
|
+
const { preserveAcronyms = false } = options ?? {};
|
|
82
|
+
// Unicode-aware regexes
|
|
83
|
+
const LEADING_PUNCTUATION = /^[^\p{L}\p{N}\s]+/u;
|
|
84
|
+
const TRAILING_PUNCTUATION = /[^\p{L}\p{N}\s]+$/u;
|
|
85
|
+
const SEPARATOR = format === 'Title Case' ? /[^\p{L}\p{N}-]+/gu : /[^\p{L}\p{N}]+/gu;
|
|
86
|
+
const CAMEL_BOUNDARY = /(?<=[\p{Ll}\p{N}])(?=\p{Lu})|(?<=[\p{Lu}])(?=\p{Lu}[\p{Ll}])/u;
|
|
87
|
+
const LETTER_NUMBER_BOUNDARY = /(?<=[\p{L}])(?=\p{N})|(?<=[\p{N}])(?=\p{L})/u;
|
|
88
|
+
// preserve leading/trailing punctuation (but not spaces)
|
|
89
|
+
const start = value.match(LEADING_PUNCTUATION)?.[0] ?? '';
|
|
90
|
+
const end = value.match(TRAILING_PUNCTUATION)?.[0] ?? '';
|
|
91
|
+
// core trimmed of leading/trailing punctuation (but keep internal separators)
|
|
92
|
+
const core = value
|
|
93
|
+
.replace(/^[^\p{L}\p{N}\s]+|[^\p{L}\p{N}\s]+$/gu, '')
|
|
94
|
+
.trim();
|
|
95
|
+
const lower = (s) => s.toLowerCase();
|
|
96
|
+
const isAcronym = (s) => s.length >= 2 && /^[\p{Lu}]+$/u.test(s);
|
|
97
|
+
const capitalize = (s) => s.length === 0 ?
|
|
98
|
+
''
|
|
99
|
+
: s.charAt(0).toUpperCase().concat(s.slice(1).toLowerCase());
|
|
100
|
+
// Tokenize into logical words:
|
|
101
|
+
// 1) split on explicit separators (space, underscore, dash, punctuation)
|
|
102
|
+
// 2) if result is single token, try splitting camel/pascal boundaries
|
|
103
|
+
// 3) also try splitting letter<->number boundaries
|
|
104
|
+
let tokens = core.length > 0 ? core.split(SEPARATOR).filter(Boolean) : [];
|
|
105
|
+
if (tokens.length <= 1 && core.length > 0) {
|
|
106
|
+
if (CAMEL_BOUNDARY.test(core)) {
|
|
107
|
+
tokens = core.split(CAMEL_BOUNDARY).filter(Boolean);
|
|
108
|
+
}
|
|
109
|
+
else if (LETTER_NUMBER_BOUNDARY.test(core)) {
|
|
110
|
+
tokens = core.split(LETTER_NUMBER_BOUNDARY).filter(Boolean);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
tokens = [core];
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (tokens.length === 0) {
|
|
117
|
+
// nothing meaningful to do — return only punctuation (if any)
|
|
118
|
+
return start.concat(end);
|
|
119
|
+
}
|
|
120
|
+
// Title-case small words set for fast lookup
|
|
121
|
+
const smallSet = new Set(constants_1.LOWERCASE);
|
|
122
|
+
switch (format) {
|
|
123
|
+
case 'camelCase': {
|
|
124
|
+
const firstToken = tokens[0];
|
|
125
|
+
const first = lower(firstToken);
|
|
126
|
+
const rest = tokens
|
|
127
|
+
.slice(1)
|
|
128
|
+
.map((t) => {
|
|
129
|
+
if (preserveAcronyms && isAcronym(t)) {
|
|
130
|
+
return t; // preserve acronym as-is
|
|
131
|
+
}
|
|
132
|
+
return capitalize(t);
|
|
133
|
+
})
|
|
134
|
+
.join('');
|
|
135
|
+
return start.concat(first.concat(rest), end);
|
|
136
|
+
}
|
|
137
|
+
case 'PascalCase': {
|
|
138
|
+
const body = tokens
|
|
139
|
+
.map((t) => {
|
|
140
|
+
if (preserveAcronyms && isAcronym(t))
|
|
141
|
+
return t;
|
|
142
|
+
return capitalize(t);
|
|
143
|
+
})
|
|
144
|
+
.join('');
|
|
145
|
+
return start.concat(body, end);
|
|
146
|
+
}
|
|
147
|
+
case 'snake_case': {
|
|
148
|
+
const body = tokens.map((t) => lower(t)).join('_');
|
|
149
|
+
return start.concat(body, end);
|
|
150
|
+
}
|
|
151
|
+
case 'kebab-case': {
|
|
152
|
+
const body = tokens.map((t) => lower(t)).join('-');
|
|
153
|
+
return start.concat(body, end);
|
|
154
|
+
}
|
|
155
|
+
case 'Title Case': {
|
|
156
|
+
const title = tokens
|
|
157
|
+
.map((t, i, arr) => {
|
|
158
|
+
const tlc = t.toLowerCase();
|
|
159
|
+
// keep small words lowercase unless first or last
|
|
160
|
+
if (i !== 0 && i !== arr.length - 1 && smallSet.has(tlc)) {
|
|
161
|
+
return tlc;
|
|
162
|
+
}
|
|
163
|
+
// If preserveAcronyms is enabled, preserve acronym-like subparts inside hyphenated tokens.
|
|
164
|
+
// Example: "XML-HTTP" -> ["XML","HTTP"] -> preserved -> "XML-HTTP"
|
|
165
|
+
if (preserveAcronyms && t.includes('-')) {
|
|
166
|
+
return t
|
|
167
|
+
.split('-')
|
|
168
|
+
.map((sub) => isAcronym(sub) ? sub : capitalize(sub))
|
|
169
|
+
.join('-');
|
|
170
|
+
}
|
|
171
|
+
if (preserveAcronyms && isAcronym(t)) {
|
|
172
|
+
return t.split('-');
|
|
173
|
+
}
|
|
174
|
+
return capitalize(t);
|
|
175
|
+
})
|
|
176
|
+
.join(' ');
|
|
177
|
+
return start.concat(title, end);
|
|
178
|
+
}
|
|
179
|
+
case 'lowercase': {
|
|
180
|
+
return start.concat(core.toLowerCase(), end);
|
|
181
|
+
}
|
|
182
|
+
case 'UPPERCASE': {
|
|
183
|
+
return start.concat(core.toUpperCase(), end);
|
|
184
|
+
}
|
|
185
|
+
default: {
|
|
186
|
+
return start.concat(core, end);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
@@ -1,96 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.reverseString = exports.maskString = exports.slugifyString = exports.replaceAllInString = void 0;
|
|
4
|
-
exports.convertStringCase = convertStringCase;
|
|
5
4
|
exports.normalizeString = normalizeString;
|
|
6
5
|
exports.extractEmails = extractEmails;
|
|
7
6
|
exports.extractURLs = extractURLs;
|
|
8
7
|
exports.formatUnitWithPlural = formatUnitWithPlural;
|
|
9
8
|
const basics_1 = require("./basics");
|
|
10
|
-
const constants_1 = require("./constants");
|
|
11
|
-
/**
|
|
12
|
-
* * Converts a string to a specified case format such as `camelCase`, `snake_case`, `kebab-case`, `PascalCase`, `Title Case`, `lowercase`, or `UPPERCASE`.
|
|
13
|
-
*
|
|
14
|
-
* - This function handles non-alphanumeric characters (e.g., spaces, hyphens, underscores, dots, slashes) as word delimiters. For `Title Case`, prepositions, articles, conjunctions, and auxiliary verbs are not capitalized unless they appear at the start of the title.
|
|
15
|
-
* - You can also convert the string to `lowercase` or `UPPERCASE`, but it's recommended to use default string methods like `string.toLowerCase()` and `string.toUpperCase()` for these cases.
|
|
16
|
-
*
|
|
17
|
-
* @param string The input string to be converted. The string should have words separated by non-alphanumeric characters (e.g., spaces, hyphens, underscores, etc.).
|
|
18
|
-
* @param format The format to convert the string to. The available formats are:
|
|
19
|
-
* - `'camelCase'`: Converts to camelCase (e.g., `myVariableName`).
|
|
20
|
-
* - `'snake_case'`: Converts to snake_case (e.g., `my_variable_name`).
|
|
21
|
-
* - `'kebab-case'`: Converts to kebab-case (e.g., `my-variable-name`).
|
|
22
|
-
* - `'PascalCase'`: Converts to PascalCase (e.g., `MyVariableName`).
|
|
23
|
-
* - `'Title Case'`: Converts to Title Case (e.g., `My Variable Name`), where certain words like `prepositions, articles, conjunctions and auxiliary verbs` are not capitalized unless at the start.
|
|
24
|
-
* - `'lowercase'`: Converts the string to all lowercase characters.
|
|
25
|
-
* - `'UPPERCASE'`: Converts the string to all uppercase characters.
|
|
26
|
-
* @returns The formatted string in the specified case format.
|
|
27
|
-
* @example
|
|
28
|
-
* convertStringCase('my-example_string', 'camelCase'); // returns 'myExampleString'
|
|
29
|
-
* convertStringCase('my-example_string', 'snake_case'); // returns 'my_example_string'
|
|
30
|
-
* convertStringCase('my-example_string', 'kebab-case'); // returns 'my-example-string'
|
|
31
|
-
* convertStringCase('my example string', 'Title Case'); // returns 'My Example String'
|
|
32
|
-
* convertStringCase('my example string', 'lowercase'); // returns 'my example string'
|
|
33
|
-
* convertStringCase('my example string', 'UPPERCASE'); // returns 'MY EXAMPLE STRING'
|
|
34
|
-
*/
|
|
35
|
-
function convertStringCase(string, format) {
|
|
36
|
-
if (!string || typeof string !== 'string')
|
|
37
|
-
return '';
|
|
38
|
-
const start = string?.match(/^[^\d\w\s]+/)?.[0] || '';
|
|
39
|
-
const end = string?.match(/[^\d\w\s]+$/)?.[0] || '';
|
|
40
|
-
const core = string?.replace(/^[^\d\w\s]+|[^\w\s]+$/g, '').trim();
|
|
41
|
-
const titleCase = core
|
|
42
|
-
?.split(/\s+/g)
|
|
43
|
-
?.map((part) => {
|
|
44
|
-
const startSymbol = part.match(/^[^\d\w\s]+/)?.[0] || ''; // Capture leading symbols
|
|
45
|
-
const endSymbol = part.match(/[^\d\w\s]+$/)?.[0] || ''; // Capture trailing symbols
|
|
46
|
-
const coreWord = part.replace(/^[^\d\w\s]+|[^\d\w\s]+$/g, ''); // Remove them for processing
|
|
47
|
-
if (constants_1.LOWERCASE.includes(coreWord?.toLowerCase())) {
|
|
48
|
-
return startSymbol + coreWord?.toLowerCase() + endSymbol;
|
|
49
|
-
}
|
|
50
|
-
return (startSymbol +
|
|
51
|
-
coreWord?.charAt(0)?.toUpperCase() +
|
|
52
|
-
coreWord?.slice(1)?.toLowerCase() +
|
|
53
|
-
endSymbol);
|
|
54
|
-
})
|
|
55
|
-
.join(' ');
|
|
56
|
-
const formattedString = string?.replace(/[^a-zA-Z0-9]+(.)?/g, (_, chr) => (chr ? chr?.toUpperCase() : ''));
|
|
57
|
-
if (!formattedString)
|
|
58
|
-
return '';
|
|
59
|
-
switch (format) {
|
|
60
|
-
case 'camelCase':
|
|
61
|
-
// return formattedString.replace(/[A-Z]/g, (letter, index) =>
|
|
62
|
-
// index === 0 ? letter.toUpperCase() : letter.toLowerCase(),
|
|
63
|
-
// );
|
|
64
|
-
return (formattedString.charAt(0).toLowerCase() +
|
|
65
|
-
formattedString.slice(1));
|
|
66
|
-
case 'snake_case':
|
|
67
|
-
return /[^a-zA-Z0-9]/.test(string) ?
|
|
68
|
-
string.split(/\W+/g).join('_').toLowerCase()
|
|
69
|
-
: formattedString.replace(/[A-Z]/g, (letter, index) => index === 0 ?
|
|
70
|
-
letter.toLowerCase()
|
|
71
|
-
: `_${letter.toLowerCase()}`);
|
|
72
|
-
case 'kebab-case':
|
|
73
|
-
return /[^a-zA-Z0-9]/.test(string) ?
|
|
74
|
-
string.split(/\W+/g).join('-').toLowerCase()
|
|
75
|
-
: formattedString.replace(/[A-Z]/g, (letter, index) => index === 0 ?
|
|
76
|
-
letter.toLowerCase()
|
|
77
|
-
: `-${letter.toLowerCase()}`);
|
|
78
|
-
case 'PascalCase':
|
|
79
|
-
return (formattedString.charAt(0).toUpperCase() +
|
|
80
|
-
formattedString.slice(1));
|
|
81
|
-
case 'Title Case':
|
|
82
|
-
return (start +
|
|
83
|
-
titleCase.charAt(0).toUpperCase() +
|
|
84
|
-
titleCase.slice(1) +
|
|
85
|
-
end);
|
|
86
|
-
case 'lowercase':
|
|
87
|
-
return start + core.toLowerCase() + end;
|
|
88
|
-
case 'UPPERCASE':
|
|
89
|
-
return start + core.toUpperCase() + end;
|
|
90
|
-
default:
|
|
91
|
-
return formattedString;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
9
|
/**
|
|
95
10
|
* * Replaces all occurrences of a string or pattern in the given input string.
|
|
96
11
|
*
|
|
@@ -117,7 +32,7 @@ exports.replaceAllInString = replaceAllInString;
|
|
|
117
32
|
* @returns The slugified string.
|
|
118
33
|
*/
|
|
119
34
|
const slugifyString = (input) => {
|
|
120
|
-
return (0, basics_1.trimString)(input)
|
|
35
|
+
return (0, basics_1.trimString)(normalizeString(input))
|
|
121
36
|
?.toLowerCase()
|
|
122
37
|
?.replace(/[^a-z0-9]+/g, '-')
|
|
123
38
|
?.replace(/^-+|-+$/g, '');
|
|
@@ -156,7 +71,7 @@ exports.reverseString = reverseString;
|
|
|
156
71
|
* @returns The normalized string.
|
|
157
72
|
*/
|
|
158
73
|
function normalizeString(str) {
|
|
159
|
-
return str
|
|
74
|
+
return str?.normalize('NFD')?.replace(/[\u0300-\u036f]/g, '');
|
|
160
75
|
}
|
|
161
76
|
/**
|
|
162
77
|
* * Extracts all email addresses from a string.
|
|
@@ -164,7 +79,7 @@ function normalizeString(str) {
|
|
|
164
79
|
* @returns An array of extracted email addresses.
|
|
165
80
|
*/
|
|
166
81
|
function extractEmails(str) {
|
|
167
|
-
return str
|
|
82
|
+
return str?.match(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g) || [];
|
|
168
83
|
}
|
|
169
84
|
/**
|
|
170
85
|
* * Extracts all URLs from a string.
|
|
@@ -308,6 +308,6 @@ export declare const ZODIAC_PRESETS: Readonly<{
|
|
|
308
308
|
readonly tropical: readonly [readonly ["Capricorn", readonly [12, 22]], readonly ["Aquarius", readonly [1, 20]], readonly ["Pisces", readonly [2, 19]], readonly ["Aries", readonly [3, 21]], readonly ["Taurus", readonly [4, 20]], readonly ["Gemini", readonly [5, 21]], readonly ["Cancer", readonly [6, 21]], readonly ["Leo", readonly [7, 23]], readonly ["Virgo", readonly [8, 23]], readonly ["Libra", readonly [9, 23]], readonly ["Scorpio", readonly [10, 23]], readonly ["Sagittarius", readonly [11, 22]], readonly ["Capricorn", readonly [12, 22]]];
|
|
309
309
|
readonly sidereal: readonly [readonly ["Capricorn", readonly [1, 14]], readonly ["Aquarius", readonly [2, 13]], readonly ["Pisces", readonly [3, 14]], readonly ["Aries", readonly [4, 13]], readonly ["Taurus", readonly [5, 14]], readonly ["Gemini", readonly [6, 14]], readonly ["Cancer", readonly [7, 16]], readonly ["Leo", readonly [8, 16]], readonly ["Virgo", readonly [9, 16]], readonly ["Libra", readonly [10, 16]], readonly ["Scorpio", readonly [11, 15]], readonly ["Sagittarius", readonly [12, 15]], readonly ["Capricorn", readonly [1, 14]]];
|
|
310
310
|
}>;
|
|
311
|
-
/**
|
|
311
|
+
/** @internal Symbol for accessing Chronos internals (plugin author use only) */
|
|
312
312
|
export declare const INTERNALS: unique symbol;
|
|
313
313
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/date/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAa,MAAM,SAAS,CAAC;AAE7D,uFAAuF;AACvF,eAAO,MAAM,IAAI,yFAQN,CAAC;AAEZ,mFAAmF;AACnF,eAAO,MAAM,MAAM,qIAaR,CAAC;AAEZ,eAAO,MAAM,YAAY,uCAKd,CAAC;AAEZ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DAOkB,CAAC;AAE9C,2BAA2B;AAC3B,eAAO,MAAM,oBAAoB,khBActB,CAAC;AAEZ,wBAAwB;AACxB,eAAO,MAAM,kBAAkB,ihBAcpB,CAAC;AAEZ,2BAA2B;AAC3B,eAAO,MAAM,cAAc;;;;;EAKhB,CAAC;AAEZ,gFAAgF;AAChF,eAAO,MAAM,SAAS,eAAsB,CAAC"}
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
export { capitalizeString, generateRandomID, trimString, truncateString, } from './string/basics';
|
|
17
17
|
export { generateAnagrams } from './string/anagram';
|
|
18
18
|
export { isCamelCase, isEmojiOnly, isKebabCase, isPalindrome, isPascalCase, isSnakeCase, } from './string/guards';
|
|
19
|
-
export { convertStringCase
|
|
19
|
+
export { convertStringCase } from './string/case';
|
|
20
|
+
export { extractEmails, extractURLs, formatUnitWithPlural as formatNumberWithPluralUnit, formatUnitWithPlural, formatUnitWithPlural as formatWithPlural, maskString, normalizeString, replaceAllInString, reverseString, slugifyString, } from './string/convert';
|
|
20
21
|
export { countWords, countWords as countWordsInString, extractNumbersFromString as extractNumbers, extractNumbersFromString, getLevenshteinDistance, getLevenshteinDistance as levenshteinDistance, extractNumbersFromString as parseNumbersFromText, countWords as wordCount, } from './string/utilities';
|
|
21
22
|
export { Pluralizer, pluralizer } from './pluralize/Pluralizer';
|
|
22
23
|
export { getAverage as calculateAverage, calculateHCF as calculateGCD, calculateHCF, calculateLCM as calculateLCD, calculateLCM, convertToDecimal, convertToDecimal as convertToFixed, getAverage, getAverage as getAverageOfNumbers, getRandomNumber as getRandomInt, getRandomNumber, sumNumbers as getSumOfNumbers, reverseNumber, roundNumber, roundNumber as roundToDecimal, sumDigits, sumNumbers, sumNumbers as sumOfNumbers, } from './number/basics';
|
package/dist/dts/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":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AAO,EACP,aAAa,EACb,YAAY,IAAI,iBAAiB,EACjC,MAAM,EACN,aAAa,EACb,aAAa,IAAI,kBAAkB,EACnC,OAAO,EACP,UAAU,EACV,MAAM,EACN,MAAM,IAAI,YAAY,EACtB,KAAK,EACL,kBAAkB,IAAI,QAAQ,EAC9B,kBAAkB,EAClB,gBAAgB,EAChB,QAAQ,EACR,aAAa,IAAI,aAAa,EAC9B,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,QAAQ,IAAI,mBAAmB,EAC/B,kBAAkB,EAClB,KAAK,EACL,YAAY,EACZ,MAAM,IAAI,WAAW,EACrB,KAAK,IAAI,UAAU,EACnB,gBAAgB,IAAI,aAAa,EACjC,KAAK,IAAI,UAAU,GACnB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EACN,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,aAAa,EACb,aAAa,IAAI,iBAAiB,EAClC,WAAW,EACX,MAAM,EACN,aAAa,IAAI,SAAS,EAC1B,aAAa,IAAI,iBAAiB,EAClC,eAAe,EACf,aAAa,EACb,KAAK,EACL,MAAM,EACN,OAAO,IAAI,YAAY,EACvB,KAAK,IAAI,UAAU,GACnB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { CaseFormat, StringCaseOptions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* * Converts a string to a specified case format with advanced handling for word boundaries, punctuation, acronyms, and Unicode characters.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* - This function is Unicode-aware, treats non-alphanumeric characters (spaces, underscores, dots, slashes, etc.) as word boundaries, and optionally preserves internal acronyms.
|
|
7
|
+
* - `Title Case` formatting respects small words such as prepositions, articles, conjunctions, and auxiliary verbs (defined in `LOWERCASE`) — these are not capitalized unless they appear at the start or end of the string.
|
|
8
|
+
* - Leading and trailing punctuation (non-letter/number characters) is preserved in the result.
|
|
9
|
+
*
|
|
10
|
+
* @param value - The input string to convert. Can contain letters, numbers, punctuation,
|
|
11
|
+
* spaces, underscores, dashes, etc.
|
|
12
|
+
* @param format - The target case format:
|
|
13
|
+
* - `'camelCase'` → camelCase (e.g., `myVariableName`)
|
|
14
|
+
* - `'PascalCase'` → PascalCase (e.g., `MyVariableName`)
|
|
15
|
+
* - `'snake_case'` → snake_case (e.g., `my_variable_name`)
|
|
16
|
+
* - `'kebab-case'` → kebab-case (e.g., `my-variable-name`)
|
|
17
|
+
* - `'Title Case'` → Title Case (e.g., `My Variable Name`)
|
|
18
|
+
* - `'lowercase'` → all lowercase [ It is recommended to use built-in string method `string.toLowerCase()` ]
|
|
19
|
+
* - `'UPPERCASE'` → all uppercase [ It is recommended to use built-in string method `string.toUpperCase()` ]
|
|
20
|
+
* @param options - Optional configuration settings.
|
|
21
|
+
*
|
|
22
|
+
* @returns The converted string, with leading/trailing punctuation preserved.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // Basic usage
|
|
26
|
+
* convertStringCase('my-example_string', 'camelCase');
|
|
27
|
+
* // Returns: 'myExampleString'
|
|
28
|
+
*
|
|
29
|
+
* convertStringCase('my-example_string', 'snake_case');
|
|
30
|
+
* // Returns: 'my_example_string'
|
|
31
|
+
*
|
|
32
|
+
* convertStringCase('my-example_string', 'kebab-case');
|
|
33
|
+
* // Returns: 'my-example-string'
|
|
34
|
+
*
|
|
35
|
+
* convertStringCase('my example string', 'Title Case');
|
|
36
|
+
* // Returns: 'My Example String'
|
|
37
|
+
*
|
|
38
|
+
* convertStringCase('My example String', 'lowercase');
|
|
39
|
+
* // Returns: 'my example string'
|
|
40
|
+
*
|
|
41
|
+
* convertStringCase('my example string', 'UPPERCASE');
|
|
42
|
+
* // Returns: 'MY EXAMPLE STRING'
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Preserve acronyms
|
|
46
|
+
* convertStringCase('get API response', 'camelCase', { preserveAcronyms: true });
|
|
47
|
+
* // Returns: 'getAPIResponse'
|
|
48
|
+
*
|
|
49
|
+
* convertStringCase('get API response', 'PascalCase', { preserveAcronyms: true });
|
|
50
|
+
* // Returns: 'GetAPIResponse'
|
|
51
|
+
*
|
|
52
|
+
* convertStringCase('the API of things', 'Title Case', { preserveAcronyms: true });
|
|
53
|
+
* // Returns: 'The API of Things'
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* // Leading/trailing punctuation is preserved
|
|
57
|
+
* convertStringCase('++hello_world++', 'PascalCase');
|
|
58
|
+
* // Returns: '++HelloWorld++'
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* // Dashes are preserved in Title Case
|
|
62
|
+
* convertStringCase('xml-http_request', 'Title Case');
|
|
63
|
+
* // Returns: 'Xml-http Request'
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* // Empty string returns empty
|
|
67
|
+
* convertStringCase('', 'camelCase');
|
|
68
|
+
* // Returns: ''
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* // Single token is capitalized properly
|
|
72
|
+
* convertStringCase('api', 'PascalCase');
|
|
73
|
+
* // Returns: 'Api'
|
|
74
|
+
*/
|
|
75
|
+
export declare function convertStringCase(value: string, format: CaseFormat, options?: StringCaseOptions): string;
|
|
76
|
+
//# sourceMappingURL=case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"case.d.ts","sourceRoot":"","sources":["../../../src/string/case.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AACH,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,UAAU,EAClB,OAAO,CAAC,EAAE,iBAAiB,GACzB,MAAM,CAqIR"}
|
|
@@ -1,29 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
/**
|
|
3
|
-
* * Converts a string to a specified case format such as `camelCase`, `snake_case`, `kebab-case`, `PascalCase`, `Title Case`, `lowercase`, or `UPPERCASE`.
|
|
4
|
-
*
|
|
5
|
-
* - This function handles non-alphanumeric characters (e.g., spaces, hyphens, underscores, dots, slashes) as word delimiters. For `Title Case`, prepositions, articles, conjunctions, and auxiliary verbs are not capitalized unless they appear at the start of the title.
|
|
6
|
-
* - You can also convert the string to `lowercase` or `UPPERCASE`, but it's recommended to use default string methods like `string.toLowerCase()` and `string.toUpperCase()` for these cases.
|
|
7
|
-
*
|
|
8
|
-
* @param string The input string to be converted. The string should have words separated by non-alphanumeric characters (e.g., spaces, hyphens, underscores, etc.).
|
|
9
|
-
* @param format The format to convert the string to. The available formats are:
|
|
10
|
-
* - `'camelCase'`: Converts to camelCase (e.g., `myVariableName`).
|
|
11
|
-
* - `'snake_case'`: Converts to snake_case (e.g., `my_variable_name`).
|
|
12
|
-
* - `'kebab-case'`: Converts to kebab-case (e.g., `my-variable-name`).
|
|
13
|
-
* - `'PascalCase'`: Converts to PascalCase (e.g., `MyVariableName`).
|
|
14
|
-
* - `'Title Case'`: Converts to Title Case (e.g., `My Variable Name`), where certain words like `prepositions, articles, conjunctions and auxiliary verbs` are not capitalized unless at the start.
|
|
15
|
-
* - `'lowercase'`: Converts the string to all lowercase characters.
|
|
16
|
-
* - `'UPPERCASE'`: Converts the string to all uppercase characters.
|
|
17
|
-
* @returns The formatted string in the specified case format.
|
|
18
|
-
* @example
|
|
19
|
-
* convertStringCase('my-example_string', 'camelCase'); // returns 'myExampleString'
|
|
20
|
-
* convertStringCase('my-example_string', 'snake_case'); // returns 'my_example_string'
|
|
21
|
-
* convertStringCase('my-example_string', 'kebab-case'); // returns 'my-example-string'
|
|
22
|
-
* convertStringCase('my example string', 'Title Case'); // returns 'My Example String'
|
|
23
|
-
* convertStringCase('my example string', 'lowercase'); // returns 'my example string'
|
|
24
|
-
* convertStringCase('my example string', 'UPPERCASE'); // returns 'MY EXAMPLE STRING'
|
|
25
|
-
*/
|
|
26
|
-
export declare function convertStringCase(string: string, format: CaseFormat): string;
|
|
1
|
+
import type { MaskOptions } from './types';
|
|
27
2
|
/**
|
|
28
3
|
* * Replaces all occurrences of a string or pattern in the given input string.
|
|
29
4
|
*
|
|
@@ -42,7 +17,7 @@ export declare const replaceAllInString: (input: string, find: string | RegExp,
|
|
|
42
17
|
* @param input - The string to be converted.
|
|
43
18
|
* @returns The slugified string.
|
|
44
19
|
*/
|
|
45
|
-
export declare const slugifyString: (input: string) =>
|
|
20
|
+
export declare const slugifyString: (input: string) => string;
|
|
46
21
|
/**
|
|
47
22
|
* * Masks part of a string for privacy.
|
|
48
23
|
* @param input - The string to mask.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../../src/string/convert.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../../src/string/convert.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,GAC9B,OAAO,MAAM,EACb,MAAM,MAAM,GAAG,MAAM,EACrB,SAAS,MAAM,KACb,MAYF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,MAK7C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,EAAE,UAAU,WAAW,KAAG,MAcjE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,MAI7C,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAEjD;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,UAAU,UAAO,GACf,MAAM,CAKR"}
|
|
@@ -31,6 +31,21 @@ export interface AnagramOptions {
|
|
|
31
31
|
}
|
|
32
32
|
/** - Case formats for converting a string */
|
|
33
33
|
export type CaseFormat = 'camelCase' | 'snake_case' | 'kebab-case' | 'PascalCase' | 'Title Case' | 'UPPERCASE' | 'lowercase';
|
|
34
|
+
/** * Options for convertStringCase. */
|
|
35
|
+
export interface StringCaseOptions {
|
|
36
|
+
/**
|
|
37
|
+
* Preserve acronym-like tokens (tokens that are ALL UPPERCASE with length >= 2)
|
|
38
|
+
* when converting to PascalCase / Title Case / camelCase (mid tokens).
|
|
39
|
+
*
|
|
40
|
+
* Behavior summary:
|
|
41
|
+
* - PascalCase: keep acronyms intact (API -> API).
|
|
42
|
+
* - camelCase: first token acronyms are lowercased entirely (API -> api),
|
|
43
|
+
* subsequent token acronyms are preserved (API -> API).
|
|
44
|
+
* - Title Case: acronym tokens are preserved (API).
|
|
45
|
+
* - snake_case / kebab-case: tokens are lowercased (xml-http-request).
|
|
46
|
+
*/
|
|
47
|
+
preserveAcronyms?: boolean;
|
|
48
|
+
}
|
|
34
49
|
/** Options for masking a string. */
|
|
35
50
|
export interface MaskOptions {
|
|
36
51
|
/** Number of characters to keep at the start. Defaults to `1`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/string/types.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,MAAM,WAAW,iBAAiB;IACjC,iGAAiG;IACjG,mBAAmB,CAAC,EAAE,O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468
|
tropical: WESTERN_ZODIAC_SIGNS,
|
|
469
469
|
sidereal: VEDIC_ZODIAC_SIGNS,
|
|
470
470
|
});
|
|
471
|
-
/**
|
|
471
|
+
/** @internal Symbol for accessing Chronos internals (plugin author use only) */
|
|
472
472
|
export const INTERNALS = Symbol('Internals');
|
package/dist/esm/index.js
CHANGED
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
export { capitalizeString, generateRandomID, trimString, truncateString, } from './string/basics.js';
|
|
18
18
|
export { generateAnagrams } from './string/anagram.js';
|
|
19
19
|
export { isCamelCase, isEmojiOnly, isKebabCase, isPalindrome, isPascalCase, isSnakeCase, } from './string/guards.js';
|
|
20
|
-
export { convertStringCase
|
|
20
|
+
export { convertStringCase } from './string/case.js';
|
|
21
|
+
export { extractEmails, extractURLs, formatUnitWithPlural as formatNumberWithPluralUnit, formatUnitWithPlural, formatUnitWithPlural as formatWithPlural, maskString, normalizeString, replaceAllInString, reverseString, slugifyString, } from './string/convert.js';
|
|
21
22
|
export { countWords, countWords as countWordsInString, extractNumbersFromString as extractNumbers, extractNumbersFromString, getLevenshteinDistance, getLevenshteinDistance as levenshteinDistance, extractNumbersFromString as parseNumbersFromText, countWords as wordCount, } from './string/utilities.js';
|
|
22
23
|
// ! Pluralizer Class and Its Default Instance
|
|
23
24
|
export { Pluralizer, pluralizer } from './pluralize/Pluralizer.js';
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { LOWERCASE } from './constants.js';
|
|
2
|
+
/**
|
|
3
|
+
* * Converts a string to a specified case format with advanced handling for word boundaries, punctuation, acronyms, and Unicode characters.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* - This function is Unicode-aware, treats non-alphanumeric characters (spaces, underscores, dots, slashes, etc.) as word boundaries, and optionally preserves internal acronyms.
|
|
7
|
+
* - `Title Case` formatting respects small words such as prepositions, articles, conjunctions, and auxiliary verbs (defined in `LOWERCASE`) — these are not capitalized unless they appear at the start or end of the string.
|
|
8
|
+
* - Leading and trailing punctuation (non-letter/number characters) is preserved in the result.
|
|
9
|
+
*
|
|
10
|
+
* @param value - The input string to convert. Can contain letters, numbers, punctuation,
|
|
11
|
+
* spaces, underscores, dashes, etc.
|
|
12
|
+
* @param format - The target case format:
|
|
13
|
+
* - `'camelCase'` → camelCase (e.g., `myVariableName`)
|
|
14
|
+
* - `'PascalCase'` → PascalCase (e.g., `MyVariableName`)
|
|
15
|
+
* - `'snake_case'` → snake_case (e.g., `my_variable_name`)
|
|
16
|
+
* - `'kebab-case'` → kebab-case (e.g., `my-variable-name`)
|
|
17
|
+
* - `'Title Case'` → Title Case (e.g., `My Variable Name`)
|
|
18
|
+
* - `'lowercase'` → all lowercase [ It is recommended to use built-in string method `string.toLowerCase()` ]
|
|
19
|
+
* - `'UPPERCASE'` → all uppercase [ It is recommended to use built-in string method `string.toUpperCase()` ]
|
|
20
|
+
* @param options - Optional configuration settings.
|
|
21
|
+
*
|
|
22
|
+
* @returns The converted string, with leading/trailing punctuation preserved.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // Basic usage
|
|
26
|
+
* convertStringCase('my-example_string', 'camelCase');
|
|
27
|
+
* // Returns: 'myExampleString'
|
|
28
|
+
*
|
|
29
|
+
* convertStringCase('my-example_string', 'snake_case');
|
|
30
|
+
* // Returns: 'my_example_string'
|
|
31
|
+
*
|
|
32
|
+
* convertStringCase('my-example_string', 'kebab-case');
|
|
33
|
+
* // Returns: 'my-example-string'
|
|
34
|
+
*
|
|
35
|
+
* convertStringCase('my example string', 'Title Case');
|
|
36
|
+
* // Returns: 'My Example String'
|
|
37
|
+
*
|
|
38
|
+
* convertStringCase('My example String', 'lowercase');
|
|
39
|
+
* // Returns: 'my example string'
|
|
40
|
+
*
|
|
41
|
+
* convertStringCase('my example string', 'UPPERCASE');
|
|
42
|
+
* // Returns: 'MY EXAMPLE STRING'
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Preserve acronyms
|
|
46
|
+
* convertStringCase('get API response', 'camelCase', { preserveAcronyms: true });
|
|
47
|
+
* // Returns: 'getAPIResponse'
|
|
48
|
+
*
|
|
49
|
+
* convertStringCase('get API response', 'PascalCase', { preserveAcronyms: true });
|
|
50
|
+
* // Returns: 'GetAPIResponse'
|
|
51
|
+
*
|
|
52
|
+
* convertStringCase('the API of things', 'Title Case', { preserveAcronyms: true });
|
|
53
|
+
* // Returns: 'The API of Things'
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* // Leading/trailing punctuation is preserved
|
|
57
|
+
* convertStringCase('++hello_world++', 'PascalCase');
|
|
58
|
+
* // Returns: '++HelloWorld++'
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* // Dashes are preserved in Title Case
|
|
62
|
+
* convertStringCase('xml-http_request', 'Title Case');
|
|
63
|
+
* // Returns: 'Xml-http Request'
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* // Empty string returns empty
|
|
67
|
+
* convertStringCase('', 'camelCase');
|
|
68
|
+
* // Returns: ''
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* // Single token is capitalized properly
|
|
72
|
+
* convertStringCase('api', 'PascalCase');
|
|
73
|
+
* // Returns: 'Api'
|
|
74
|
+
*/
|
|
75
|
+
export function convertStringCase(value, format, options) {
|
|
76
|
+
if (!value || typeof value !== 'string')
|
|
77
|
+
return '';
|
|
78
|
+
const { preserveAcronyms = false } = options ?? {};
|
|
79
|
+
// Unicode-aware regexes
|
|
80
|
+
const LEADING_PUNCTUATION = /^[^\p{L}\p{N}\s]+/u;
|
|
81
|
+
const TRAILING_PUNCTUATION = /[^\p{L}\p{N}\s]+$/u;
|
|
82
|
+
const SEPARATOR = format === 'Title Case' ? /[^\p{L}\p{N}-]+/gu : /[^\p{L}\p{N}]+/gu;
|
|
83
|
+
const CAMEL_BOUNDARY = /(?<=[\p{Ll}\p{N}])(?=\p{Lu})|(?<=[\p{Lu}])(?=\p{Lu}[\p{Ll}])/u;
|
|
84
|
+
const LETTER_NUMBER_BOUNDARY = /(?<=[\p{L}])(?=\p{N})|(?<=[\p{N}])(?=\p{L})/u;
|
|
85
|
+
// preserve leading/trailing punctuation (but not spaces)
|
|
86
|
+
const start = value.match(LEADING_PUNCTUATION)?.[0] ?? '';
|
|
87
|
+
const end = value.match(TRAILING_PUNCTUATION)?.[0] ?? '';
|
|
88
|
+
// core trimmed of leading/trailing punctuation (but keep internal separators)
|
|
89
|
+
const core = value
|
|
90
|
+
.replace(/^[^\p{L}\p{N}\s]+|[^\p{L}\p{N}\s]+$/gu, '')
|
|
91
|
+
.trim();
|
|
92
|
+
const lower = (s) => s.toLowerCase();
|
|
93
|
+
const isAcronym = (s) => s.length >= 2 && /^[\p{Lu}]+$/u.test(s);
|
|
94
|
+
const capitalize = (s) => s.length === 0 ?
|
|
95
|
+
''
|
|
96
|
+
: s.charAt(0).toUpperCase().concat(s.slice(1).toLowerCase());
|
|
97
|
+
// Tokenize into logical words:
|
|
98
|
+
// 1) split on explicit separators (space, underscore, dash, punctuation)
|
|
99
|
+
// 2) if result is single token, try splitting camel/pascal boundaries
|
|
100
|
+
// 3) also try splitting letter<->number boundaries
|
|
101
|
+
let tokens = core.length > 0 ? core.split(SEPARATOR).filter(Boolean) : [];
|
|
102
|
+
if (tokens.length <= 1 && core.length > 0) {
|
|
103
|
+
if (CAMEL_BOUNDARY.test(core)) {
|
|
104
|
+
tokens = core.split(CAMEL_BOUNDARY).filter(Boolean);
|
|
105
|
+
}
|
|
106
|
+
else if (LETTER_NUMBER_BOUNDARY.test(core)) {
|
|
107
|
+
tokens = core.split(LETTER_NUMBER_BOUNDARY).filter(Boolean);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
tokens = [core];
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (tokens.length === 0) {
|
|
114
|
+
// nothing meaningful to do — return only punctuation (if any)
|
|
115
|
+
return start.concat(end);
|
|
116
|
+
}
|
|
117
|
+
// Title-case small words set for fast lookup
|
|
118
|
+
const smallSet = new Set(LOWERCASE);
|
|
119
|
+
switch (format) {
|
|
120
|
+
case 'camelCase': {
|
|
121
|
+
const firstToken = tokens[0];
|
|
122
|
+
const first = lower(firstToken);
|
|
123
|
+
const rest = tokens
|
|
124
|
+
.slice(1)
|
|
125
|
+
.map((t) => {
|
|
126
|
+
if (preserveAcronyms && isAcronym(t)) {
|
|
127
|
+
return t; // preserve acronym as-is
|
|
128
|
+
}
|
|
129
|
+
return capitalize(t);
|
|
130
|
+
})
|
|
131
|
+
.join('');
|
|
132
|
+
return start.concat(first.concat(rest), end);
|
|
133
|
+
}
|
|
134
|
+
case 'PascalCase': {
|
|
135
|
+
const body = tokens
|
|
136
|
+
.map((t) => {
|
|
137
|
+
if (preserveAcronyms && isAcronym(t))
|
|
138
|
+
return t;
|
|
139
|
+
return capitalize(t);
|
|
140
|
+
})
|
|
141
|
+
.join('');
|
|
142
|
+
return start.concat(body, end);
|
|
143
|
+
}
|
|
144
|
+
case 'snake_case': {
|
|
145
|
+
const body = tokens.map((t) => lower(t)).join('_');
|
|
146
|
+
return start.concat(body, end);
|
|
147
|
+
}
|
|
148
|
+
case 'kebab-case': {
|
|
149
|
+
const body = tokens.map((t) => lower(t)).join('-');
|
|
150
|
+
return start.concat(body, end);
|
|
151
|
+
}
|
|
152
|
+
case 'Title Case': {
|
|
153
|
+
const title = tokens
|
|
154
|
+
.map((t, i, arr) => {
|
|
155
|
+
const tlc = t.toLowerCase();
|
|
156
|
+
// keep small words lowercase unless first or last
|
|
157
|
+
if (i !== 0 && i !== arr.length - 1 && smallSet.has(tlc)) {
|
|
158
|
+
return tlc;
|
|
159
|
+
}
|
|
160
|
+
// If preserveAcronyms is enabled, preserve acronym-like subparts inside hyphenated tokens.
|
|
161
|
+
// Example: "XML-HTTP" -> ["XML","HTTP"] -> preserved -> "XML-HTTP"
|
|
162
|
+
if (preserveAcronyms && t.includes('-')) {
|
|
163
|
+
return t
|
|
164
|
+
.split('-')
|
|
165
|
+
.map((sub) => isAcronym(sub) ? sub : capitalize(sub))
|
|
166
|
+
.join('-');
|
|
167
|
+
}
|
|
168
|
+
if (preserveAcronyms && isAcronym(t)) {
|
|
169
|
+
return t.split('-');
|
|
170
|
+
}
|
|
171
|
+
return capitalize(t);
|
|
172
|
+
})
|
|
173
|
+
.join(' ');
|
|
174
|
+
return start.concat(title, end);
|
|
175
|
+
}
|
|
176
|
+
case 'lowercase': {
|
|
177
|
+
return start.concat(core.toLowerCase(), end);
|
|
178
|
+
}
|
|
179
|
+
case 'UPPERCASE': {
|
|
180
|
+
return start.concat(core.toUpperCase(), end);
|
|
181
|
+
}
|
|
182
|
+
default: {
|
|
183
|
+
return start.concat(core, end);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
@@ -1,88 +1,4 @@
|
|
|
1
1
|
import { trimString } from './basics.js';
|
|
2
|
-
import { LOWERCASE } from './constants.js';
|
|
3
|
-
/**
|
|
4
|
-
* * Converts a string to a specified case format such as `camelCase`, `snake_case`, `kebab-case`, `PascalCase`, `Title Case`, `lowercase`, or `UPPERCASE`.
|
|
5
|
-
*
|
|
6
|
-
* - This function handles non-alphanumeric characters (e.g., spaces, hyphens, underscores, dots, slashes) as word delimiters. For `Title Case`, prepositions, articles, conjunctions, and auxiliary verbs are not capitalized unless they appear at the start of the title.
|
|
7
|
-
* - You can also convert the string to `lowercase` or `UPPERCASE`, but it's recommended to use default string methods like `string.toLowerCase()` and `string.toUpperCase()` for these cases.
|
|
8
|
-
*
|
|
9
|
-
* @param string The input string to be converted. The string should have words separated by non-alphanumeric characters (e.g., spaces, hyphens, underscores, etc.).
|
|
10
|
-
* @param format The format to convert the string to. The available formats are:
|
|
11
|
-
* - `'camelCase'`: Converts to camelCase (e.g., `myVariableName`).
|
|
12
|
-
* - `'snake_case'`: Converts to snake_case (e.g., `my_variable_name`).
|
|
13
|
-
* - `'kebab-case'`: Converts to kebab-case (e.g., `my-variable-name`).
|
|
14
|
-
* - `'PascalCase'`: Converts to PascalCase (e.g., `MyVariableName`).
|
|
15
|
-
* - `'Title Case'`: Converts to Title Case (e.g., `My Variable Name`), where certain words like `prepositions, articles, conjunctions and auxiliary verbs` are not capitalized unless at the start.
|
|
16
|
-
* - `'lowercase'`: Converts the string to all lowercase characters.
|
|
17
|
-
* - `'UPPERCASE'`: Converts the string to all uppercase characters.
|
|
18
|
-
* @returns The formatted string in the specified case format.
|
|
19
|
-
* @example
|
|
20
|
-
* convertStringCase('my-example_string', 'camelCase'); // returns 'myExampleString'
|
|
21
|
-
* convertStringCase('my-example_string', 'snake_case'); // returns 'my_example_string'
|
|
22
|
-
* convertStringCase('my-example_string', 'kebab-case'); // returns 'my-example-string'
|
|
23
|
-
* convertStringCase('my example string', 'Title Case'); // returns 'My Example String'
|
|
24
|
-
* convertStringCase('my example string', 'lowercase'); // returns 'my example string'
|
|
25
|
-
* convertStringCase('my example string', 'UPPERCASE'); // returns 'MY EXAMPLE STRING'
|
|
26
|
-
*/
|
|
27
|
-
export function convertStringCase(string, format) {
|
|
28
|
-
if (!string || typeof string !== 'string')
|
|
29
|
-
return '';
|
|
30
|
-
const start = string?.match(/^[^\d\w\s]+/)?.[0] || '';
|
|
31
|
-
const end = string?.match(/[^\d\w\s]+$/)?.[0] || '';
|
|
32
|
-
const core = string?.replace(/^[^\d\w\s]+|[^\w\s]+$/g, '').trim();
|
|
33
|
-
const titleCase = core
|
|
34
|
-
?.split(/\s+/g)
|
|
35
|
-
?.map((part) => {
|
|
36
|
-
const startSymbol = part.match(/^[^\d\w\s]+/)?.[0] || ''; // Capture leading symbols
|
|
37
|
-
const endSymbol = part.match(/[^\d\w\s]+$/)?.[0] || ''; // Capture trailing symbols
|
|
38
|
-
const coreWord = part.replace(/^[^\d\w\s]+|[^\d\w\s]+$/g, ''); // Remove them for processing
|
|
39
|
-
if (LOWERCASE.includes(coreWord?.toLowerCase())) {
|
|
40
|
-
return startSymbol + coreWord?.toLowerCase() + endSymbol;
|
|
41
|
-
}
|
|
42
|
-
return (startSymbol +
|
|
43
|
-
coreWord?.charAt(0)?.toUpperCase() +
|
|
44
|
-
coreWord?.slice(1)?.toLowerCase() +
|
|
45
|
-
endSymbol);
|
|
46
|
-
})
|
|
47
|
-
.join(' ');
|
|
48
|
-
const formattedString = string?.replace(/[^a-zA-Z0-9]+(.)?/g, (_, chr) => (chr ? chr?.toUpperCase() : ''));
|
|
49
|
-
if (!formattedString)
|
|
50
|
-
return '';
|
|
51
|
-
switch (format) {
|
|
52
|
-
case 'camelCase':
|
|
53
|
-
// return formattedString.replace(/[A-Z]/g, (letter, index) =>
|
|
54
|
-
// index === 0 ? letter.toUpperCase() : letter.toLowerCase(),
|
|
55
|
-
// );
|
|
56
|
-
return (formattedString.charAt(0).toLowerCase() +
|
|
57
|
-
formattedString.slice(1));
|
|
58
|
-
case 'snake_case':
|
|
59
|
-
return /[^a-zA-Z0-9]/.test(string) ?
|
|
60
|
-
string.split(/\W+/g).join('_').toLowerCase()
|
|
61
|
-
: formattedString.replace(/[A-Z]/g, (letter, index) => index === 0 ?
|
|
62
|
-
letter.toLowerCase()
|
|
63
|
-
: `_${letter.toLowerCase()}`);
|
|
64
|
-
case 'kebab-case':
|
|
65
|
-
return /[^a-zA-Z0-9]/.test(string) ?
|
|
66
|
-
string.split(/\W+/g).join('-').toLowerCase()
|
|
67
|
-
: formattedString.replace(/[A-Z]/g, (letter, index) => index === 0 ?
|
|
68
|
-
letter.toLowerCase()
|
|
69
|
-
: `-${letter.toLowerCase()}`);
|
|
70
|
-
case 'PascalCase':
|
|
71
|
-
return (formattedString.charAt(0).toUpperCase() +
|
|
72
|
-
formattedString.slice(1));
|
|
73
|
-
case 'Title Case':
|
|
74
|
-
return (start +
|
|
75
|
-
titleCase.charAt(0).toUpperCase() +
|
|
76
|
-
titleCase.slice(1) +
|
|
77
|
-
end);
|
|
78
|
-
case 'lowercase':
|
|
79
|
-
return start + core.toLowerCase() + end;
|
|
80
|
-
case 'UPPERCASE':
|
|
81
|
-
return start + core.toUpperCase() + end;
|
|
82
|
-
default:
|
|
83
|
-
return formattedString;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
2
|
/**
|
|
87
3
|
* * Replaces all occurrences of a string or pattern in the given input string.
|
|
88
4
|
*
|
|
@@ -108,7 +24,7 @@ export const replaceAllInString = (input, find, replace) => {
|
|
|
108
24
|
* @returns The slugified string.
|
|
109
25
|
*/
|
|
110
26
|
export const slugifyString = (input) => {
|
|
111
|
-
return trimString(input)
|
|
27
|
+
return trimString(normalizeString(input))
|
|
112
28
|
?.toLowerCase()
|
|
113
29
|
?.replace(/[^a-z0-9]+/g, '-')
|
|
114
30
|
?.replace(/^-+|-+$/g, '');
|
|
@@ -144,7 +60,7 @@ export const reverseString = (input) => {
|
|
|
144
60
|
* @returns The normalized string.
|
|
145
61
|
*/
|
|
146
62
|
export function normalizeString(str) {
|
|
147
|
-
return str
|
|
63
|
+
return str?.normalize('NFD')?.replace(/[\u0300-\u036f]/g, '');
|
|
148
64
|
}
|
|
149
65
|
/**
|
|
150
66
|
* * Extracts all email addresses from a string.
|
|
@@ -152,7 +68,7 @@ export function normalizeString(str) {
|
|
|
152
68
|
* @returns An array of extracted email addresses.
|
|
153
69
|
*/
|
|
154
70
|
export function extractEmails(str) {
|
|
155
|
-
return str
|
|
71
|
+
return str?.match(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g) || [];
|
|
156
72
|
}
|
|
157
73
|
/**
|
|
158
74
|
* * Extracts all URLs from a string.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nhb-toolbox",
|
|
3
|
-
"version": "4.14.
|
|
3
|
+
"version": "4.14.7",
|
|
4
4
|
"description": "A versatile collection of smart, efficient, and reusable utility functions and classes for everyday development needs.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -252,6 +252,7 @@
|
|
|
252
252
|
},
|
|
253
253
|
"scripts": {
|
|
254
254
|
"test": "jest --coverage --verbose",
|
|
255
|
+
"test:watch": "jest --onlyChanged --verbose --watch",
|
|
255
256
|
"start": "start coverage/lcov-report/index.html",
|
|
256
257
|
"format": "nhb-format",
|
|
257
258
|
"lint": "nhb-lint",
|