complete-common 2.7.0 → 2.7.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.
|
@@ -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;AAsBH,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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C_REGEX = /\p{Diacritic}/u;
|
|
403
|
-
const EMOJI_REGEX = /(\p{Extended_Pictographic}
|
|
403
|
+
const EMOJI_REGEX = /(\p{Extended_Pictographic}|[#*0-9]\uFE0F?\u20E3)/u;
|
|
404
404
|
const FIRST_LETTER_CAPITALIZED_REGEX = /^\p{Lu}/u;
|
|
405
405
|
const KEBAB_CASE_REGEX = /^[\da-z]+(?:-[\da-z]+)*$/;
|
|
406
406
|
const SEMANTIC_VERSION_REGEX = /^v*(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)/;
|
package/dist/index.mjs
CHANGED
|
@@ -398,7 +398,7 @@ function todo(...args) {
|
|
|
398
398
|
}
|
|
399
399
|
|
|
400
400
|
const DIACRITIC_REGEX = /\p{Diacritic}/u;
|
|
401
|
-
const EMOJI_REGEX = /(\p{Extended_Pictographic}
|
|
401
|
+
const EMOJI_REGEX = /(\p{Extended_Pictographic}|[#*0-9]\uFE0F?\u20E3)/u;
|
|
402
402
|
const FIRST_LETTER_CAPITALIZED_REGEX = /^\p{Lu}/u;
|
|
403
403
|
const KEBAB_CASE_REGEX = /^[\da-z]+(?:-[\da-z]+)*$/;
|
|
404
404
|
const SEMANTIC_VERSION_REGEX = /^v*(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)/;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "complete-common",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"description": "Helper functions for TypeScript projects.",
|
|
5
5
|
"homepage": "https://complete-ts.github.io/",
|
|
6
6
|
"bugs": {
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"test": "tsx --test"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@types/node": "24.7.
|
|
35
|
-
"complete-node": "12.2.
|
|
34
|
+
"@types/node": "24.7.2",
|
|
35
|
+
"complete-node": "12.2.1",
|
|
36
36
|
"eslint-plugin-sort-exports": "0.9.1",
|
|
37
37
|
"typescript": "5.9.3",
|
|
38
38
|
"typescript-eslint": "8.46.0",
|
|
@@ -9,14 +9,27 @@ import {
|
|
|
9
9
|
} from "./string.js";
|
|
10
10
|
|
|
11
11
|
describe("hasEmoji", () => {
|
|
12
|
-
test("should return true for string with emoji", () => {
|
|
12
|
+
test("should return true for string with normal emoji", () => {
|
|
13
13
|
equal(hasEmoji("Hello 😃 World"), true);
|
|
14
|
-
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test("should return true for string with keycap emoji", () => {
|
|
17
|
+
equal(hasEmoji("This is a keycap emoji: #️⃣"), true);
|
|
15
18
|
});
|
|
16
19
|
|
|
17
20
|
test("should return false for string without emoji", () => {
|
|
18
21
|
equal(hasEmoji("Hello World"), false);
|
|
19
|
-
equal(
|
|
22
|
+
equal(
|
|
23
|
+
hasEmoji(`
|
|
24
|
+
# Some Markdown Title
|
|
25
|
+
|
|
26
|
+
This page is for people who like [cake](https://en.wikipedia.org/wiki/Cake).
|
|
27
|
+
|
|
28
|
+
- Run \`npm run cake\` to get cake.
|
|
29
|
+
- Run \`npm run pie\` to get pie.
|
|
30
|
+
`),
|
|
31
|
+
false,
|
|
32
|
+
);
|
|
20
33
|
});
|
|
21
34
|
|
|
22
35
|
test("should handle empty string", () => {
|
|
@@ -123,9 +136,11 @@ describe("trimPrefix", () => {
|
|
|
123
136
|
});
|
|
124
137
|
|
|
125
138
|
describe("trimSuffix", () => {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
139
|
+
test(() => {
|
|
140
|
+
equal(trimSuffix("foo", ""), "foo");
|
|
141
|
+
equal(trimSuffix("foo", "o"), "fo");
|
|
142
|
+
equal(trimSuffix("foo", "oo"), "f");
|
|
143
|
+
equal(trimSuffix("foo", "foo"), "");
|
|
144
|
+
equal(trimSuffix("foo", "1foo"), "foo");
|
|
145
|
+
});
|
|
131
146
|
});
|
package/src/functions/string.ts
CHANGED
|
@@ -11,8 +11,11 @@ import { parseIntSafe } from "./utils.js";
|
|
|
11
11
|
|
|
12
12
|
const DIACRITIC_REGEX = /\p{Diacritic}/u;
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
|
|
14
|
+
/**
|
|
15
|
+
* - We can't use `/\p{Emoji}/u` because it has a false positive on "#" characters.
|
|
16
|
+
* - We can't use `/\p{Extended_Pictographic}/u` because it has a false negative on keycap emojis.
|
|
17
|
+
*/
|
|
18
|
+
const EMOJI_REGEX = /(\p{Extended_Pictographic}|[#*0-9]\uFE0F?\u20E3)/u;
|
|
16
19
|
|
|
17
20
|
const FIRST_LETTER_CAPITALIZED_REGEX = /^\p{Lu}/u;
|
|
18
21
|
const KEBAB_CASE_REGEX = /^[\da-z]+(?:-[\da-z]+)*$/;
|