complete-common 2.3.0 → 2.3.1
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.
|
@@ -33,7 +33,11 @@ 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;
|
|
38
42
|
/**
|
|
39
43
|
* Helper function to check if a given string is a valid Semantic Version.
|
|
@@ -33,7 +33,11 @@ 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;
|
|
38
42
|
/**
|
|
39
43
|
* Helper function to check if a given string is a valid Semantic Version.
|
|
@@ -33,7 +33,11 @@ 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;
|
|
38
42
|
/**
|
|
39
43
|
* Helper function to check if a given string is a valid Semantic Version.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/functions/string.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiBH,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
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/functions/string.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiBH,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,QAA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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,7 +347,7 @@ 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
353
|
function capitalizeFirstLetter(string) {
|
|
@@ -392,9 +392,6 @@ function isFirstLetterCapitalized(string) {
|
|
|
392
392
|
return FIRST_LETTER_CAPITALIZED_REGEX.test(string);
|
|
393
393
|
}
|
|
394
394
|
function isKebabCase(string) {
|
|
395
|
-
if (string === "") {
|
|
396
|
-
return false;
|
|
397
|
-
}
|
|
398
395
|
return KEBAB_CASE_REGEX.test(string);
|
|
399
396
|
}
|
|
400
397
|
function isSemanticVersion(versionString) {
|
package/dist/index.mjs
CHANGED
|
@@ -345,7 +345,7 @@ 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
351
|
function capitalizeFirstLetter(string) {
|
|
@@ -390,9 +390,6 @@ function isFirstLetterCapitalized(string) {
|
|
|
390
390
|
return FIRST_LETTER_CAPITALIZED_REGEX.test(string);
|
|
391
391
|
}
|
|
392
392
|
function isKebabCase(string) {
|
|
393
|
-
if (string === "") {
|
|
394
|
-
return false;
|
|
395
|
-
}
|
|
396
393
|
return KEBAB_CASE_REGEX.test(string);
|
|
397
394
|
}
|
|
398
395
|
function isSemanticVersion(versionString) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "complete-common",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
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.4",
|
|
39
|
+
"complete-node": "7.2.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.35.0",
|
|
44
44
|
"unbuild": "3.5.0"
|
|
45
45
|
}
|
|
46
46
|
}
|
package/src/functions/string.ts
CHANGED
|
@@ -15,7 +15,7 @@ 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
21
|
|
|
@@ -107,12 +107,12 @@ export function isFirstLetterCapitalized(string: string): boolean {
|
|
|
107
107
|
return FIRST_LETTER_CAPITALIZED_REGEX.test(string);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
/**
|
|
110
|
+
/**
|
|
111
|
+
* "kebab-case" is the naming style of using all lowercase and hyphens, like "foo-bar".
|
|
112
|
+
*
|
|
113
|
+
* An empty string is not considered to be kebab-case.
|
|
114
|
+
*/
|
|
111
115
|
export function isKebabCase(string: string): boolean {
|
|
112
|
-
if (string === "") {
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
116
|
return KEBAB_CASE_REGEX.test(string);
|
|
117
117
|
}
|
|
118
118
|
|