complete-common 2.3.0 → 2.4.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/dist/functions/string.d.cts +9 -1
- package/dist/functions/string.d.mts +9 -1
- package/dist/functions/string.d.ts +9 -1
- package/dist/functions/string.d.ts.map +1 -1
- package/dist/index.cjs +11 -4
- package/dist/index.mjs +10 -5
- package/package.json +4 -4
- package/src/functions/string.test.ts +25 -1
- package/src/functions/string.ts +18 -6
|
@@ -33,14 +33,22 @@ export declare function hasWhitespace(string: string): boolean;
|
|
|
33
33
|
* https://stackoverflow.com/questions/8334606/check-if-first-letter-of-word-is-a-capital-letter
|
|
34
34
|
*/
|
|
35
35
|
export declare function isFirstLetterCapitalized(string: string): boolean;
|
|
36
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* "kebab-case" is the naming style of using all lowercase and hyphens, like "foo-bar".
|
|
38
|
+
*
|
|
39
|
+
* An empty string is not considered to be kebab-case.
|
|
40
|
+
*/
|
|
37
41
|
export declare function isKebabCase(string: string): boolean;
|
|
42
|
+
/** Helper function to test if a string contains only lowercase ASCII letters (a through z). */
|
|
43
|
+
export declare function isLowerCase(string: string): boolean;
|
|
38
44
|
/**
|
|
39
45
|
* Helper function to check if a given string is a valid Semantic Version.
|
|
40
46
|
*
|
|
41
47
|
* @see https://semver.org/
|
|
42
48
|
*/
|
|
43
49
|
export declare function isSemanticVersion(versionString: string): boolean;
|
|
50
|
+
/** Helper function to test if a string contains only uppercase ASCII letters (A through Z). */
|
|
51
|
+
export declare function isUpperCase(string: string): boolean;
|
|
44
52
|
/** Helper function to convert a string from kebab-case to camelCase. */
|
|
45
53
|
export declare function kebabCaseToCamelCase(string: string): string;
|
|
46
54
|
/** Helper function to convert a string from kebab-case to PascalCase. */
|
|
@@ -33,14 +33,22 @@ export declare function hasWhitespace(string: string): boolean;
|
|
|
33
33
|
* https://stackoverflow.com/questions/8334606/check-if-first-letter-of-word-is-a-capital-letter
|
|
34
34
|
*/
|
|
35
35
|
export declare function isFirstLetterCapitalized(string: string): boolean;
|
|
36
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* "kebab-case" is the naming style of using all lowercase and hyphens, like "foo-bar".
|
|
38
|
+
*
|
|
39
|
+
* An empty string is not considered to be kebab-case.
|
|
40
|
+
*/
|
|
37
41
|
export declare function isKebabCase(string: string): boolean;
|
|
42
|
+
/** Helper function to test if a string contains only lowercase ASCII letters (a through z). */
|
|
43
|
+
export declare function isLowerCase(string: string): boolean;
|
|
38
44
|
/**
|
|
39
45
|
* Helper function to check if a given string is a valid Semantic Version.
|
|
40
46
|
*
|
|
41
47
|
* @see https://semver.org/
|
|
42
48
|
*/
|
|
43
49
|
export declare function isSemanticVersion(versionString: string): boolean;
|
|
50
|
+
/** Helper function to test if a string contains only uppercase ASCII letters (A through Z). */
|
|
51
|
+
export declare function isUpperCase(string: string): boolean;
|
|
44
52
|
/** Helper function to convert a string from kebab-case to camelCase. */
|
|
45
53
|
export declare function kebabCaseToCamelCase(string: string): string;
|
|
46
54
|
/** Helper function to convert a string from kebab-case to PascalCase. */
|
|
@@ -33,14 +33,22 @@ export declare function hasWhitespace(string: string): boolean;
|
|
|
33
33
|
* https://stackoverflow.com/questions/8334606/check-if-first-letter-of-word-is-a-capital-letter
|
|
34
34
|
*/
|
|
35
35
|
export declare function isFirstLetterCapitalized(string: string): boolean;
|
|
36
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* "kebab-case" is the naming style of using all lowercase and hyphens, like "foo-bar".
|
|
38
|
+
*
|
|
39
|
+
* An empty string is not considered to be kebab-case.
|
|
40
|
+
*/
|
|
37
41
|
export declare function isKebabCase(string: string): boolean;
|
|
42
|
+
/** Helper function to test if a string contains only lowercase ASCII letters (a through z). */
|
|
43
|
+
export declare function isLowerCase(string: string): boolean;
|
|
38
44
|
/**
|
|
39
45
|
* Helper function to check if a given string is a valid Semantic Version.
|
|
40
46
|
*
|
|
41
47
|
* @see https://semver.org/
|
|
42
48
|
*/
|
|
43
49
|
export declare function isSemanticVersion(versionString: string): boolean;
|
|
50
|
+
/** Helper function to test if a string contains only uppercase ASCII letters (A through Z). */
|
|
51
|
+
export declare function isUpperCase(string: string): boolean;
|
|
44
52
|
/** Helper function to convert a string from kebab-case to camelCase. */
|
|
45
53
|
export declare function kebabCaseToCamelCase(string: string): string;
|
|
46
54
|
/** Helper function to convert a string from kebab-case to PascalCase. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/functions/string.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/functions/string.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH,kEAAkE;AAClE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAU5D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAO3D;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAqBlE;AAED,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAOpD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED,0FAA0F;AAC1F,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,+FAA+F;AAC/F,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAGhE;AAED,+FAA+F;AAC/F,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,wEAAwE;AACxE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAO3D;AAED,yEAAyE;AACzE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAG5D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAiBtD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GACtD;IACE,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;IAErB,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IAErB,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;CACtB,GACD,SAAS,CAwBZ;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,MAAM,CAuBR;AAED,gGAAgG;AAChG,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIzE;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,UAAQ,GACd,MAAM,CAWR;AAED,gGAAgG;AAChG,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAOjE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAMxE"}
|
package/dist/index.cjs
CHANGED
|
@@ -347,9 +347,11 @@ function todo(...args) {
|
|
|
347
347
|
const DIACRITIC_REGEX = /\p{Diacritic}/u;
|
|
348
348
|
const EMOJI_REGEX = /(\p{Extended_Pictographic}|\p{Emoji_Component})/u;
|
|
349
349
|
const FIRST_LETTER_CAPITALIZED_REGEX = /^\p{Lu}/u;
|
|
350
|
-
const KEBAB_CASE_REGEX = /^[\da-z]+(?:-[\da-z]+)
|
|
350
|
+
const KEBAB_CASE_REGEX = /^[\da-z]+(?:-[\da-z]+)*$/;
|
|
351
351
|
const SEMANTIC_VERSION_REGEX = /^v*(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)/;
|
|
352
352
|
const WHITESPACE_REGEX = /\s/g;
|
|
353
|
+
const UPPERCASE_REGEX = /^[A-Z]*$/;
|
|
354
|
+
const LOWERCASE_REGEX = /^[a-z]*$/;
|
|
353
355
|
function capitalizeFirstLetter(string) {
|
|
354
356
|
if (string === "") {
|
|
355
357
|
return string;
|
|
@@ -392,15 +394,18 @@ function isFirstLetterCapitalized(string) {
|
|
|
392
394
|
return FIRST_LETTER_CAPITALIZED_REGEX.test(string);
|
|
393
395
|
}
|
|
394
396
|
function isKebabCase(string) {
|
|
395
|
-
if (string === "") {
|
|
396
|
-
return false;
|
|
397
|
-
}
|
|
398
397
|
return KEBAB_CASE_REGEX.test(string);
|
|
399
398
|
}
|
|
399
|
+
function isLowerCase(string) {
|
|
400
|
+
return LOWERCASE_REGEX.test(string);
|
|
401
|
+
}
|
|
400
402
|
function isSemanticVersion(versionString) {
|
|
401
403
|
const match = versionString.match(SEMANTIC_VERSION_REGEX);
|
|
402
404
|
return match !== null;
|
|
403
405
|
}
|
|
406
|
+
function isUpperCase(string) {
|
|
407
|
+
return UPPERCASE_REGEX.test(string);
|
|
408
|
+
}
|
|
404
409
|
function kebabCaseToCamelCase(string) {
|
|
405
410
|
return string.replaceAll(/-./g, (match) => {
|
|
406
411
|
const firstLetterOfWord = match[1];
|
|
@@ -554,8 +559,10 @@ exports.isEnumValue = isEnumValue;
|
|
|
554
559
|
exports.isFirstLetterCapitalized = isFirstLetterCapitalized;
|
|
555
560
|
exports.isKebabCase = isKebabCase;
|
|
556
561
|
exports.isKeyOf = isKeyOf;
|
|
562
|
+
exports.isLowerCase = isLowerCase;
|
|
557
563
|
exports.isObject = isObject;
|
|
558
564
|
exports.isSemanticVersion = isSemanticVersion;
|
|
565
|
+
exports.isUpperCase = isUpperCase;
|
|
559
566
|
exports.kebabCaseToCamelCase = kebabCaseToCamelCase;
|
|
560
567
|
exports.kebabCaseToPascalCase = kebabCaseToPascalCase;
|
|
561
568
|
exports.mapFilter = mapFilter;
|
package/dist/index.mjs
CHANGED
|
@@ -345,9 +345,11 @@ function todo(...args) {
|
|
|
345
345
|
const DIACRITIC_REGEX = /\p{Diacritic}/u;
|
|
346
346
|
const EMOJI_REGEX = /(\p{Extended_Pictographic}|\p{Emoji_Component})/u;
|
|
347
347
|
const FIRST_LETTER_CAPITALIZED_REGEX = /^\p{Lu}/u;
|
|
348
|
-
const KEBAB_CASE_REGEX = /^[\da-z]+(?:-[\da-z]+)
|
|
348
|
+
const KEBAB_CASE_REGEX = /^[\da-z]+(?:-[\da-z]+)*$/;
|
|
349
349
|
const SEMANTIC_VERSION_REGEX = /^v*(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)/;
|
|
350
350
|
const WHITESPACE_REGEX = /\s/g;
|
|
351
|
+
const UPPERCASE_REGEX = /^[A-Z]*$/;
|
|
352
|
+
const LOWERCASE_REGEX = /^[a-z]*$/;
|
|
351
353
|
function capitalizeFirstLetter(string) {
|
|
352
354
|
if (string === "") {
|
|
353
355
|
return string;
|
|
@@ -390,15 +392,18 @@ function isFirstLetterCapitalized(string) {
|
|
|
390
392
|
return FIRST_LETTER_CAPITALIZED_REGEX.test(string);
|
|
391
393
|
}
|
|
392
394
|
function isKebabCase(string) {
|
|
393
|
-
if (string === "") {
|
|
394
|
-
return false;
|
|
395
|
-
}
|
|
396
395
|
return KEBAB_CASE_REGEX.test(string);
|
|
397
396
|
}
|
|
397
|
+
function isLowerCase(string) {
|
|
398
|
+
return LOWERCASE_REGEX.test(string);
|
|
399
|
+
}
|
|
398
400
|
function isSemanticVersion(versionString) {
|
|
399
401
|
const match = versionString.match(SEMANTIC_VERSION_REGEX);
|
|
400
402
|
return match !== null;
|
|
401
403
|
}
|
|
404
|
+
function isUpperCase(string) {
|
|
405
|
+
return UPPERCASE_REGEX.test(string);
|
|
406
|
+
}
|
|
402
407
|
function kebabCaseToCamelCase(string) {
|
|
403
408
|
return string.replaceAll(/-./g, (match) => {
|
|
404
409
|
const firstLetterOfWord = match[1];
|
|
@@ -506,4 +511,4 @@ function* tupleKeys(tuple) {
|
|
|
506
511
|
|
|
507
512
|
const ReadonlyMap = Map;
|
|
508
513
|
|
|
509
|
-
export { HOUR_IN_MILLISECONDS, MINUTE_IN_MILLISECONDS, ReadonlyMap, ReadonlySet, SECOND_IN_MILLISECONDS, addSetsToSet, arrayCopyTwoDimensional, arrayEquals, arrayRemove, arrayRemoveInPlace, assertArray, assertBoolean, assertDefined, assertEnumValue, assertNotNull, assertNumber, assertObject, assertString, capitalizeFirstLetter, clamp, combineSets, copySet, eRange, emptyArray, escapeHTMLCharacters, filterMap, getElapsedSeconds, getEnumEntries, getEnumKeys, getEnumValues, getNumConsecutiveDiacritics, getRandomArrayElement, getRandomArrayIndex, getRandomInt, hasDiacritic, hasEmoji, hasWhitespace, iRange, includes, includesAny, interfaceSatisfiesEnum, isArray, isEnumValue, isFirstLetterCapitalized, isKebabCase, isKeyOf, isObject, isSemanticVersion, kebabCaseToCamelCase, kebabCaseToPascalCase, mapFilter, mapFind, newArray, noop, normalizeString, objectFilter, objectKeysToSet, objectToMap, objectToReverseMap, objectValuesToSet, parseFloatSafe, parseIntSafe, parseSemanticVersion, removeLinesBetweenMarkers, removeLinesMatching, removeNonPrintableCharacters, removeWhitespace, repeat, setAdd, setHas, sortCaseInsensitive, sumArray, todo, trimPrefix, trimSuffix, truncateString, tupleEntries, tupleKeys };
|
|
514
|
+
export { HOUR_IN_MILLISECONDS, MINUTE_IN_MILLISECONDS, ReadonlyMap, ReadonlySet, SECOND_IN_MILLISECONDS, addSetsToSet, arrayCopyTwoDimensional, arrayEquals, arrayRemove, arrayRemoveInPlace, assertArray, assertBoolean, assertDefined, assertEnumValue, assertNotNull, assertNumber, assertObject, assertString, capitalizeFirstLetter, clamp, combineSets, copySet, eRange, emptyArray, escapeHTMLCharacters, filterMap, getElapsedSeconds, getEnumEntries, getEnumKeys, getEnumValues, getNumConsecutiveDiacritics, getRandomArrayElement, getRandomArrayIndex, getRandomInt, hasDiacritic, hasEmoji, hasWhitespace, iRange, includes, includesAny, interfaceSatisfiesEnum, isArray, isEnumValue, isFirstLetterCapitalized, isKebabCase, isKeyOf, isLowerCase, isObject, isSemanticVersion, isUpperCase, kebabCaseToCamelCase, kebabCaseToPascalCase, mapFilter, mapFind, newArray, noop, normalizeString, objectFilter, objectKeysToSet, objectToMap, objectToReverseMap, objectValuesToSet, parseFloatSafe, parseIntSafe, parseSemanticVersion, removeLinesBetweenMarkers, removeLinesMatching, removeNonPrintableCharacters, removeWhitespace, repeat, setAdd, setHas, sortCaseInsensitive, sumArray, todo, trimPrefix, trimSuffix, truncateString, tupleEntries, tupleKeys };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "complete-common",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Helper functions for TypeScript projects.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://complete-ts.github.io/",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"test": "glob \"./src/**/*.test.ts\" --cmd=\"node --import tsx --test --test-reporter spec\""
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@types/node": "24.0.
|
|
39
|
-
"complete-node": "7.0
|
|
38
|
+
"@types/node": "24.0.14",
|
|
39
|
+
"complete-node": "7.4.0",
|
|
40
40
|
"eslint-plugin-sort-exports": "0.9.1",
|
|
41
41
|
"glob": "11.0.3",
|
|
42
42
|
"typescript": "5.8.3",
|
|
43
|
-
"typescript-eslint": "8.
|
|
43
|
+
"typescript-eslint": "8.37.0",
|
|
44
44
|
"unbuild": "3.5.0"
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { equal } from "node:assert";
|
|
2
2
|
import test, { describe } from "node:test";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
hasDiacritic,
|
|
5
|
+
hasEmoji,
|
|
6
|
+
isKebabCase,
|
|
7
|
+
trimPrefix,
|
|
8
|
+
trimSuffix,
|
|
9
|
+
} from "./string.js";
|
|
4
10
|
|
|
5
11
|
describe("hasEmoji", () => {
|
|
6
12
|
test("should return true for string with emoji", () => {
|
|
@@ -105,3 +111,21 @@ describe("isKebabCase", () => {
|
|
|
105
111
|
equal(isKebabCase(""), false);
|
|
106
112
|
});
|
|
107
113
|
});
|
|
114
|
+
|
|
115
|
+
describe("trimPrefix", () => {
|
|
116
|
+
test(() => {
|
|
117
|
+
equal(trimPrefix("foo", ""), "foo");
|
|
118
|
+
equal(trimPrefix("foo", "f"), "oo");
|
|
119
|
+
equal(trimPrefix("foo", "fo"), "o");
|
|
120
|
+
equal(trimPrefix("foo", "foo"), "");
|
|
121
|
+
equal(trimPrefix("foo", "foo1"), "foo");
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
describe("trimSuffix", () => {
|
|
126
|
+
equal(trimSuffix("foo", ""), "foo");
|
|
127
|
+
equal(trimSuffix("foo", "o"), "fo");
|
|
128
|
+
equal(trimSuffix("foo", "oo"), "f");
|
|
129
|
+
equal(trimSuffix("foo", "foo"), "");
|
|
130
|
+
equal(trimSuffix("foo", "1foo"), "foo");
|
|
131
|
+
});
|
package/src/functions/string.ts
CHANGED
|
@@ -15,9 +15,11 @@ const DIACRITIC_REGEX = /\p{Diacritic}/u;
|
|
|
15
15
|
const EMOJI_REGEX = /(\p{Extended_Pictographic}|\p{Emoji_Component})/u;
|
|
16
16
|
|
|
17
17
|
const FIRST_LETTER_CAPITALIZED_REGEX = /^\p{Lu}/u;
|
|
18
|
-
const KEBAB_CASE_REGEX = /^[\da-z]+(?:-[\da-z]+)
|
|
18
|
+
const KEBAB_CASE_REGEX = /^[\da-z]+(?:-[\da-z]+)*$/;
|
|
19
19
|
const SEMANTIC_VERSION_REGEX = /^v*(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)/;
|
|
20
20
|
const WHITESPACE_REGEX = /\s/g;
|
|
21
|
+
const UPPERCASE_REGEX = /^[A-Z]*$/;
|
|
22
|
+
const LOWERCASE_REGEX = /^[a-z]*$/;
|
|
21
23
|
|
|
22
24
|
/** Helper function to capitalize the first letter of a string. */
|
|
23
25
|
export function capitalizeFirstLetter(string: string): string {
|
|
@@ -107,15 +109,20 @@ export function isFirstLetterCapitalized(string: string): boolean {
|
|
|
107
109
|
return FIRST_LETTER_CAPITALIZED_REGEX.test(string);
|
|
108
110
|
}
|
|
109
111
|
|
|
110
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* "kebab-case" is the naming style of using all lowercase and hyphens, like "foo-bar".
|
|
114
|
+
*
|
|
115
|
+
* An empty string is not considered to be kebab-case.
|
|
116
|
+
*/
|
|
111
117
|
export function isKebabCase(string: string): boolean {
|
|
112
|
-
if (string === "") {
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
118
|
return KEBAB_CASE_REGEX.test(string);
|
|
117
119
|
}
|
|
118
120
|
|
|
121
|
+
/** Helper function to test if a string contains only lowercase ASCII letters (a through z). */
|
|
122
|
+
export function isLowerCase(string: string): boolean {
|
|
123
|
+
return LOWERCASE_REGEX.test(string);
|
|
124
|
+
}
|
|
125
|
+
|
|
119
126
|
/**
|
|
120
127
|
* Helper function to check if a given string is a valid Semantic Version.
|
|
121
128
|
*
|
|
@@ -126,6 +133,11 @@ export function isSemanticVersion(versionString: string): boolean {
|
|
|
126
133
|
return match !== null;
|
|
127
134
|
}
|
|
128
135
|
|
|
136
|
+
/** Helper function to test if a string contains only uppercase ASCII letters (A through Z). */
|
|
137
|
+
export function isUpperCase(string: string): boolean {
|
|
138
|
+
return UPPERCASE_REGEX.test(string);
|
|
139
|
+
}
|
|
140
|
+
|
|
129
141
|
/** Helper function to convert a string from kebab-case to camelCase. */
|
|
130
142
|
export function kebabCaseToCamelCase(string: string): string {
|
|
131
143
|
return string.replaceAll(/-./g, (match) => {
|