happy-dom 20.2.0 → 20.3.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StringUtility.d.ts","sourceRoot":"","sources":["../../src/utilities/StringUtility.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StringUtility.d.ts","sourceRoot":"","sources":["../../src/utilities/StringUtility.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IACjC;;;;;;OAMG;WACW,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAYlD;;;;;;OAMG;WACW,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAWlD"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const ASCII_LOWER_CASE_CACHE = new Map();
|
|
2
2
|
const ASCII_UPPER_CASE_CACHE = new Map();
|
|
3
|
+
const ASCII_UPPER_CASE_REGEXP = /[A-Z]/g;
|
|
4
|
+
const ASCII_LOWER_CASE_REGEXP = /[a-z]/g;
|
|
3
5
|
/**
|
|
4
6
|
* String utility.
|
|
5
7
|
*/
|
|
@@ -16,16 +18,7 @@ export default class StringUtility {
|
|
|
16
18
|
if (cached) {
|
|
17
19
|
return cached;
|
|
18
20
|
}
|
|
19
|
-
|
|
20
|
-
for (const char of text) {
|
|
21
|
-
const value = char.charCodeAt(0);
|
|
22
|
-
if (value >= 65 && value <= 90) {
|
|
23
|
-
newText += String.fromCharCode(value + 32);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
newText += char;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
21
|
+
const newText = text.replace(ASCII_UPPER_CASE_REGEXP, (char) => String.fromCharCode(char.charCodeAt(0) + 32));
|
|
29
22
|
ASCII_LOWER_CASE_CACHE.set(text, newText);
|
|
30
23
|
return newText;
|
|
31
24
|
}
|
|
@@ -41,16 +34,7 @@ export default class StringUtility {
|
|
|
41
34
|
if (cached) {
|
|
42
35
|
return cached;
|
|
43
36
|
}
|
|
44
|
-
|
|
45
|
-
for (const char of text) {
|
|
46
|
-
const value = char.charCodeAt(0);
|
|
47
|
-
if (value >= 97 && value <= 122) {
|
|
48
|
-
newText += String.fromCharCode(value - 32);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
newText += char;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
37
|
+
const newText = text.replace(ASCII_LOWER_CASE_REGEXP, (char) => String.fromCharCode(char.charCodeAt(0) - 32));
|
|
54
38
|
ASCII_UPPER_CASE_CACHE.set(text, newText);
|
|
55
39
|
return newText;
|
|
56
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StringUtility.js","sourceRoot":"","sources":["../../src/utilities/StringUtility.ts"],"names":[],"mappings":"AAAA,MAAM,sBAAsB,GAAwB,IAAI,GAAG,EAAE,CAAC;AAC9D,MAAM,sBAAsB,GAAwB,IAAI,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"StringUtility.js","sourceRoot":"","sources":["../../src/utilities/StringUtility.ts"],"names":[],"mappings":"AAAA,MAAM,sBAAsB,GAAwB,IAAI,GAAG,EAAE,CAAC;AAC9D,MAAM,sBAAsB,GAAwB,IAAI,GAAG,EAAE,CAAC;AAC9D,MAAM,uBAAuB,GAAG,QAAQ,CAAC;AACzC,MAAM,uBAAuB,GAAG,QAAQ,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IACjC;;;;;;OAMG;IACI,MAAM,CAAC,cAAc,CAAC,IAAY;QACxC,MAAM,MAAM,GAAG,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChD,IAAI,MAAM,EAAE,CAAC;YACZ,OAAO,MAAM,CAAC;QACf,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,uBAAuB,EAAE,CAAC,IAAI,EAAE,EAAE,CAC9D,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAC5C,CAAC;QACF,sBAAsB,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC1C,OAAO,OAAO,CAAC;IAChB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,cAAc,CAAC,IAAY;QACxC,MAAM,MAAM,GAAG,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChD,IAAI,MAAM,EAAE,CAAC;YACZ,OAAO,MAAM,CAAC;QACf,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,uBAAuB,EAAE,CAAC,IAAI,EAAE,EAAE,CAC9D,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAC5C,CAAC;QACF,sBAAsB,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC1C,OAAO,OAAO,CAAC;IAChB,CAAC;CACD"}
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default { version: '20.
|
|
1
|
+
export default { version: '20.3.0' };
|
package/package.json
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const ASCII_LOWER_CASE_CACHE: Map<string, string> = new Map();
|
|
2
2
|
const ASCII_UPPER_CASE_CACHE: Map<string, string> = new Map();
|
|
3
|
+
const ASCII_UPPER_CASE_REGEXP = /[A-Z]/g;
|
|
4
|
+
const ASCII_LOWER_CASE_REGEXP = /[a-z]/g;
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* String utility.
|
|
@@ -17,15 +19,9 @@ export default class StringUtility {
|
|
|
17
19
|
if (cached) {
|
|
18
20
|
return cached;
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (value >= 65 && value <= 90) {
|
|
24
|
-
newText += String.fromCharCode(value + 32);
|
|
25
|
-
} else {
|
|
26
|
-
newText += char;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
22
|
+
const newText = text.replace(ASCII_UPPER_CASE_REGEXP, (char) =>
|
|
23
|
+
String.fromCharCode(char.charCodeAt(0) + 32)
|
|
24
|
+
);
|
|
29
25
|
ASCII_LOWER_CASE_CACHE.set(text, newText);
|
|
30
26
|
return newText;
|
|
31
27
|
}
|
|
@@ -42,15 +38,9 @@ export default class StringUtility {
|
|
|
42
38
|
if (cached) {
|
|
43
39
|
return cached;
|
|
44
40
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (value >= 97 && value <= 122) {
|
|
49
|
-
newText += String.fromCharCode(value - 32);
|
|
50
|
-
} else {
|
|
51
|
-
newText += char;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
41
|
+
const newText = text.replace(ASCII_LOWER_CASE_REGEXP, (char) =>
|
|
42
|
+
String.fromCharCode(char.charCodeAt(0) - 32)
|
|
43
|
+
);
|
|
54
44
|
ASCII_UPPER_CASE_CACHE.set(text, newText);
|
|
55
45
|
return newText;
|
|
56
46
|
}
|