@base-web-kits/base-tools-ts 0.9.10 → 0.9.12
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/base-tools-ts.umd.global.js +20 -15
- package/dist/base-tools-ts.umd.global.js.map +1 -1
- package/dist/day/index.d.ts +1 -1
- package/dist/index.cjs +21 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -15
- package/dist/index.js.map +1 -1
- package/dist/string/other.d.ts +13 -11
- package/dist/string/other.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ts/day/index.ts +1 -1
- package/src/ts/string/other.ts +36 -24
package/dist/index.js
CHANGED
|
@@ -7547,22 +7547,27 @@ function createTimeRandId(digits = 6) {
|
|
|
7547
7547
|
}
|
|
7548
7548
|
|
|
7549
7549
|
// src/ts/string/other.ts
|
|
7550
|
-
function
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7550
|
+
function getByteLength(data) {
|
|
7551
|
+
if (typeof data === "string") {
|
|
7552
|
+
let byteLen = 0;
|
|
7553
|
+
for (let i = 0; i < data.length; i++) {
|
|
7554
|
+
const code = data.charCodeAt(i);
|
|
7555
|
+
if (code <= 127) {
|
|
7556
|
+
byteLen += 1;
|
|
7557
|
+
} else if (code <= 2047) {
|
|
7558
|
+
byteLen += 2;
|
|
7559
|
+
} else if (code >= 55296 && code <= 56319) {
|
|
7560
|
+
byteLen += 4;
|
|
7561
|
+
i++;
|
|
7562
|
+
} else {
|
|
7563
|
+
byteLen += 3;
|
|
7564
|
+
}
|
|
7563
7565
|
}
|
|
7566
|
+
return byteLen;
|
|
7564
7567
|
}
|
|
7565
|
-
return
|
|
7568
|
+
if ("byteLength" in data) return data.byteLength;
|
|
7569
|
+
if ("size" in data) return data.size;
|
|
7570
|
+
throw new TypeError("getByteLength: Unsupported type");
|
|
7566
7571
|
}
|
|
7567
7572
|
|
|
7568
7573
|
// src/ts/url/file/index.ts
|
|
@@ -8238,6 +8243,7 @@ export {
|
|
|
8238
8243
|
functionsIn_default as functionsIn,
|
|
8239
8244
|
get_default as get,
|
|
8240
8245
|
getAgeByBirthdate,
|
|
8246
|
+
getByteLength,
|
|
8241
8247
|
getCountdownParts,
|
|
8242
8248
|
getDateRangeAfter,
|
|
8243
8249
|
getDateRangeBefore,
|
|
@@ -8252,7 +8258,6 @@ export {
|
|
|
8252
8258
|
getQnHls,
|
|
8253
8259
|
getQnImg,
|
|
8254
8260
|
getQnVideo,
|
|
8255
|
-
getStringByteLength,
|
|
8256
8261
|
getUrlNumber,
|
|
8257
8262
|
getUrlParam,
|
|
8258
8263
|
getUrlParamAll,
|