sculp-js 1.18.1 → 1.18.3
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/cjs/{array.js → array.cjs} +1 -1
- package/dist/cjs/{async.js → async.cjs} +1 -1
- package/dist/cjs/{base64.js → base64.cjs} +3 -3
- package/dist/cjs/{clipboard.js → clipboard.cjs} +3 -3
- package/dist/cjs/{cloneDeep.js → cloneDeep.cjs} +1 -1
- package/dist/cjs/{cookie.js → cookie.cjs} +2 -2
- package/dist/cjs/{date.js → date.cjs} +2 -2
- package/dist/cjs/{dom.js → dom.cjs} +4 -4
- package/dist/cjs/{download.js → download.cjs} +3 -3
- package/dist/cjs/{file.js → file.cjs} +2 -2
- package/dist/cjs/{func.js → func.cjs} +1 -1
- package/dist/cjs/{index.js → index.cjs} +29 -29
- package/dist/cjs/{isEqual.js → isEqual.cjs} +1 -1
- package/dist/cjs/{math.js → math.cjs} +1 -1
- package/dist/cjs/{number.js → number.cjs} +4 -4
- package/dist/cjs/{object.js → object.cjs} +2 -2
- package/dist/cjs/{path.js → path.cjs} +1 -1
- package/dist/cjs/{qs.js → qs.cjs} +3 -3
- package/dist/cjs/{random.js → random.cjs} +3 -3
- package/dist/cjs/{string.js → string.cjs} +1 -1
- package/dist/cjs/{tooltip.js → tooltip.cjs} +3 -3
- package/dist/cjs/{tree.js → tree.cjs} +3 -3
- package/dist/cjs/{type.js → type.cjs} +1 -1
- package/dist/cjs/{unicodeToolkit.js → unicodeToolkit.cjs} +17 -14
- package/dist/cjs/{unique.js → unique.cjs} +4 -4
- package/dist/cjs/{url.js → url.cjs} +4 -4
- package/dist/cjs/{validator.js → validator.cjs} +1 -1
- package/dist/cjs/{variable.js → variable.cjs} +2 -2
- package/dist/cjs/{watermark.js → watermark.cjs} +2 -2
- package/dist/esm/{array.js → array.mjs} +1 -1
- package/dist/esm/{async.js → async.mjs} +1 -1
- package/dist/esm/{base64.js → base64.mjs} +3 -3
- package/dist/esm/{clipboard.js → clipboard.mjs} +3 -3
- package/dist/esm/{cloneDeep.js → cloneDeep.mjs} +1 -1
- package/dist/esm/{cookie.js → cookie.mjs} +2 -2
- package/dist/esm/{date.js → date.mjs} +2 -2
- package/dist/esm/{dom.js → dom.mjs} +4 -4
- package/dist/esm/{download.js → download.mjs} +3 -3
- package/dist/esm/{file.js → file.mjs} +2 -2
- package/dist/esm/{func.js → func.mjs} +1 -1
- package/dist/esm/{index.js → index.mjs} +29 -29
- package/dist/esm/{isEqual.js → isEqual.mjs} +1 -1
- package/dist/esm/{math.js → math.mjs} +1 -1
- package/dist/esm/{number.js → number.mjs} +4 -4
- package/dist/esm/{object.js → object.mjs} +2 -2
- package/dist/esm/{path.js → path.mjs} +1 -1
- package/dist/esm/{qs.js → qs.mjs} +3 -3
- package/dist/esm/{random.js → random.mjs} +3 -3
- package/dist/esm/{string.js → string.mjs} +1 -1
- package/dist/esm/{tooltip.js → tooltip.mjs} +3 -3
- package/dist/esm/{tree.js → tree.mjs} +3 -3
- package/dist/esm/{type.js → type.mjs} +1 -1
- package/dist/esm/{unicodeToolkit.js → unicodeToolkit.mjs} +17 -14
- package/dist/esm/{unique.js → unique.mjs} +4 -4
- package/dist/esm/{url.js → url.mjs} +4 -4
- package/dist/esm/{validator.js → validator.mjs} +1 -1
- package/dist/esm/{variable.js → variable.mjs} +2 -2
- package/dist/esm/{watermark.js → watermark.mjs} +2 -2
- package/dist/types/unicodeToolkit.d.ts +16 -13
- package/dist/umd/index.min.js +1 -1
- package/package.json +98 -125
- package/dist/sculp-js.d.ts +0 -1515
- package/dist/types/tsdoc-metadata.json +0 -11
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.18.
|
|
2
|
+
* sculp-js v1.18.3
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
export { arrayEach, arrayEachAsync, arrayInsertBefore, arrayRemove, diffArray } from './array.
|
|
8
|
-
export { copyText, fallbackCopyText } from './clipboard.
|
|
9
|
-
export { cookieDel, cookieGet, cookieSet } from './cookie.
|
|
7
|
+
export { arrayEach, arrayEachAsync, arrayInsertBefore, arrayRemove, diffArray } from './array.mjs';
|
|
8
|
+
export { copyText, fallbackCopyText } from './clipboard.mjs';
|
|
9
|
+
export { cookieDel, cookieGet, cookieSet } from './cookie.mjs';
|
|
10
10
|
export {
|
|
11
11
|
calculateDate,
|
|
12
12
|
calculateDateTime,
|
|
@@ -15,7 +15,7 @@ export {
|
|
|
15
15
|
dateToStart,
|
|
16
16
|
formatDate,
|
|
17
17
|
isValidDate
|
|
18
|
-
} from './date.
|
|
18
|
+
} from './date.mjs';
|
|
19
19
|
export {
|
|
20
20
|
addClass,
|
|
21
21
|
getComputedCssVal,
|
|
@@ -25,8 +25,8 @@ export {
|
|
|
25
25
|
removeClass,
|
|
26
26
|
select,
|
|
27
27
|
setStyle
|
|
28
|
-
} from './dom.
|
|
29
|
-
export { crossOriginDownload, downloadBlob, downloadData, downloadHref, downloadURL } from './download.
|
|
28
|
+
} from './dom.mjs';
|
|
29
|
+
export { crossOriginDownload, downloadBlob, downloadData, downloadHref, downloadURL } from './download.mjs';
|
|
30
30
|
export {
|
|
31
31
|
isPlainObject,
|
|
32
32
|
objectAssign,
|
|
@@ -38,9 +38,9 @@ export {
|
|
|
38
38
|
objectAssign as objectMerge,
|
|
39
39
|
objectOmit,
|
|
40
40
|
objectPick
|
|
41
|
-
} from './object.
|
|
42
|
-
export { pathJoin, pathNormalize } from './path.
|
|
43
|
-
export { qsParse, qsStringify } from './qs.
|
|
41
|
+
} from './object.mjs';
|
|
42
|
+
export { pathJoin, pathNormalize } from './path.mjs';
|
|
43
|
+
export { qsParse, qsStringify } from './qs.mjs';
|
|
44
44
|
export {
|
|
45
45
|
STRING_ARABIC_NUMERALS,
|
|
46
46
|
STRING_LOWERCASE_ALPHA,
|
|
@@ -52,7 +52,7 @@ export {
|
|
|
52
52
|
stringFill,
|
|
53
53
|
stringFormat,
|
|
54
54
|
stringKebabCase
|
|
55
|
-
} from './string.
|
|
55
|
+
} from './string.mjs';
|
|
56
56
|
export {
|
|
57
57
|
arrayLike,
|
|
58
58
|
isArray,
|
|
@@ -77,13 +77,13 @@ export {
|
|
|
77
77
|
isUndefined,
|
|
78
78
|
objectHas,
|
|
79
79
|
default as typeIs
|
|
80
|
-
} from './type.
|
|
81
|
-
export { urlDelParams, urlParse, urlSetParams, urlStringify } from './url.
|
|
82
|
-
export { asyncMap, safeAwait, wait } from './async.
|
|
83
|
-
export { chooseLocalFile, compressImg, supportCanvas } from './file.
|
|
84
|
-
export { genCanvasWM } from './watermark.
|
|
85
|
-
export { debounce, getGlobal, once, setGlobal, throttle } from './func.
|
|
86
|
-
export { STRING_POOL, randomNumber, randomString, randomUuid } from './random.
|
|
80
|
+
} from './type.mjs';
|
|
81
|
+
export { urlDelParams, urlParse, urlSetParams, urlStringify } from './url.mjs';
|
|
82
|
+
export { asyncMap, safeAwait, wait } from './async.mjs';
|
|
83
|
+
export { chooseLocalFile, compressImg, supportCanvas } from './file.mjs';
|
|
84
|
+
export { genCanvasWM } from './watermark.mjs';
|
|
85
|
+
export { debounce, getGlobal, once, setGlobal, throttle } from './func.mjs';
|
|
86
|
+
export { STRING_POOL, randomNumber, randomString, randomUuid } from './random.mjs';
|
|
87
87
|
export {
|
|
88
88
|
HEX_POOL,
|
|
89
89
|
formatMoney,
|
|
@@ -91,9 +91,9 @@ export {
|
|
|
91
91
|
humanFileSize,
|
|
92
92
|
numberAbbr,
|
|
93
93
|
numberToHex
|
|
94
|
-
} from './number.
|
|
95
|
-
export { UNIQUE_NUMBER_SAFE_LENGTH, uniqueNumber, uniqueString } from './unique.
|
|
96
|
-
export { tooltipEvent } from './tooltip.
|
|
94
|
+
} from './number.mjs';
|
|
95
|
+
export { UNIQUE_NUMBER_SAFE_LENGTH, uniqueNumber, uniqueString } from './unique.mjs';
|
|
96
|
+
export { tooltipEvent } from './tooltip.mjs';
|
|
97
97
|
export {
|
|
98
98
|
filterDeep,
|
|
99
99
|
findDeep,
|
|
@@ -103,9 +103,9 @@ export {
|
|
|
103
103
|
fuzzySearchTree,
|
|
104
104
|
mapDeep,
|
|
105
105
|
searchTreeById
|
|
106
|
-
} from './tree.
|
|
107
|
-
export { add, divide, multiply, strip, subtract } from './math.
|
|
108
|
-
export { b64decode, b64encode, weAtob, weBtoa } from './base64.
|
|
106
|
+
} from './tree.mjs';
|
|
107
|
+
export { add, divide, multiply, strip, subtract } from './math.mjs';
|
|
108
|
+
export { b64decode, b64encode, weAtob, weBtoa } from './base64.mjs';
|
|
109
109
|
export {
|
|
110
110
|
EMAIL_REGEX,
|
|
111
111
|
HTTP_URL_REGEX,
|
|
@@ -123,8 +123,8 @@ export {
|
|
|
123
123
|
isNumerical,
|
|
124
124
|
isPhone,
|
|
125
125
|
isUrl
|
|
126
|
-
} from './validator.
|
|
127
|
-
export { escapeRegExp, executeInScope, parseVarFromString, replaceVarFromString, uniqueSymbol } from './variable.
|
|
128
|
-
export { cloneDeep } from './cloneDeep.
|
|
129
|
-
export { isEqual } from './isEqual.
|
|
130
|
-
export { UnicodeToolkit } from './unicodeToolkit.
|
|
126
|
+
} from './validator.mjs';
|
|
127
|
+
export { escapeRegExp, executeInScope, parseVarFromString, replaceVarFromString, uniqueSymbol } from './variable.mjs';
|
|
128
|
+
export { cloneDeep } from './cloneDeep.mjs';
|
|
129
|
+
export { isEqual } from './isEqual.mjs';
|
|
130
|
+
export { UnicodeToolkit } from './unicodeToolkit.mjs';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.18.
|
|
2
|
+
* sculp-js v1.18.3
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { getGlobal } from './func.
|
|
8
|
-
import { STRING_ARABIC_NUMERALS, STRING_UPPERCASE_ALPHA, STRING_LOWERCASE_ALPHA } from './string.
|
|
9
|
-
import { isNullOrUnDef } from './type.
|
|
7
|
+
import { getGlobal } from './func.mjs';
|
|
8
|
+
import { STRING_ARABIC_NUMERALS, STRING_UPPERCASE_ALPHA, STRING_LOWERCASE_ALPHA } from './string.mjs';
|
|
9
|
+
import { isNullOrUnDef } from './type.mjs';
|
|
10
10
|
|
|
11
11
|
const HEX_POOL = `${STRING_ARABIC_NUMERALS}${STRING_UPPERCASE_ALPHA}${STRING_LOWERCASE_ALPHA}`;
|
|
12
12
|
const supportBigInt = typeof BigInt !== 'undefined';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.18.
|
|
2
|
+
* sculp-js v1.18.3
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import typeIs, { isObject, objectHas, isNumber, isUndefined, isArray } from './type.
|
|
7
|
+
import typeIs, { isObject, objectHas, isNumber, isUndefined, isArray } from './type.mjs';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* 判断对象是否为纯对象
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.18.
|
|
2
|
+
* sculp-js v1.18.3
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { objectEach } from './object.
|
|
8
|
-
import { isUndefined, isArray, isString, isNumber, isBoolean, isDate } from './type.
|
|
7
|
+
import { objectEach } from './object.mjs';
|
|
8
|
+
import { isUndefined, isArray, isString, isNumber, isBoolean, isDate } from './type.mjs';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* 解析查询参数,内部使用的是浏览器内置的 URLSearchParams 进行处理
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.18.
|
|
2
|
+
* sculp-js v1.18.3
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { STRING_ARABIC_NUMERALS, STRING_UPPERCASE_ALPHA, STRING_LOWERCASE_ALPHA } from './string.
|
|
8
|
-
import { isString, isNumber } from './type.
|
|
7
|
+
import { STRING_ARABIC_NUMERALS, STRING_UPPERCASE_ALPHA, STRING_LOWERCASE_ALPHA } from './string.mjs';
|
|
8
|
+
import { isString, isNumber } from './type.mjs';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* 随机整数
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.18.
|
|
2
|
+
* sculp-js v1.18.3
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { getStrWidthPx } from './dom.
|
|
8
|
-
import { isString } from './type.
|
|
7
|
+
import { getStrWidthPx } from './dom.mjs';
|
|
8
|
+
import { isString } from './type.mjs';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* 自定义的 tooltip, 支持鼠标移动动悬浮提示
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.18.
|
|
2
|
+
* sculp-js v1.18.3
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { objectOmit } from './object.
|
|
8
|
-
import { isObject, objectHas, isNodeList } from './type.
|
|
7
|
+
import { objectOmit } from './object.mjs';
|
|
8
|
+
import { isObject, objectHas, isNodeList } from './type.mjs';
|
|
9
9
|
|
|
10
10
|
const defaultFieldOptions = { keyField: 'key', childField: 'children', pidField: 'pid' };
|
|
11
11
|
const defaultSearchTreeOptions = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.18.
|
|
2
|
+
* sculp-js v1.18.3
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -28,18 +28,19 @@ class UnicodeToolkit {
|
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
30
30
|
* 编码函数
|
|
31
|
-
* @param str 原始字符串
|
|
32
|
-
* @param mode 'unicode' (\uXXXX) | 'html' ({) | 'entities' (命名实体)
|
|
33
|
-
* @param encodeAll 是否编码 ASCII 可见字符 (默认 false,仅编码非 ASCII 和特殊字符)
|
|
34
|
-
*
|
|
31
|
+
* @param {string} str 原始字符串
|
|
32
|
+
* @param {'unicode'|'html'} mode 'unicode' (\uXXXX) | 'html' ({) | 'entities' (命名实体)
|
|
33
|
+
* @param {boolean} encodeAll 是否编码 ASCII 可见字符 (默认 false,仅编码非 ASCII 和特殊字符)
|
|
34
|
+
* @returns {string} 编码后的字符串
|
|
35
|
+
* @example
|
|
35
36
|
* // Unicode 编码 (默认仅编码非 ASCII)
|
|
36
37
|
* UnicodeToolkit.encode('Hi 你好 😀')
|
|
37
|
-
* // => 'Hi
|
|
38
|
-
*
|
|
38
|
+
* // => 'Hi \u4F60\u597D \u{1F600}'
|
|
39
|
+
* @example
|
|
39
40
|
* // 全部Unicode 编码
|
|
40
41
|
* UnicodeToolkit.encode('Hi 你好 😀','unicode', true)
|
|
41
|
-
* // => '
|
|
42
|
-
*
|
|
42
|
+
* // => '\u0048\u0069\u0020\u4F60\u597D\u0020\u{1F600}'
|
|
43
|
+
* @example
|
|
43
44
|
* // HTML 实体编码
|
|
44
45
|
* UnicodeToolkit.encode('<script>', 'html',true)
|
|
45
46
|
* // => '<script>&'
|
|
@@ -73,16 +74,18 @@ class UnicodeToolkit {
|
|
|
73
74
|
}
|
|
74
75
|
/**
|
|
75
76
|
* 综合解码 (支持 \uXXXX, \u{XXXX}, HTML 实体, 十六进制实体)
|
|
76
|
-
* @param normalizeSpace 是否将 \u00A0 ( ) 转换为普通空格 \u0020
|
|
77
|
-
*
|
|
77
|
+
* @param {boolean} normalizeSpace 是否将 \u00A0 ( ) 转换为普通空格 \u0020
|
|
78
|
+
* @returns {string} 解码后的字符串
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
78
81
|
* // 解码 Unicode 和 Emoji
|
|
79
|
-
* UnicodeToolkit.decode('
|
|
82
|
+
* UnicodeToolkit.decode('\u4F60\u597D\u{1F680}')
|
|
80
83
|
* // => '你好🚀'
|
|
81
|
-
*
|
|
84
|
+
* @example
|
|
82
85
|
* // 解码 HTML 实体 (支持十进制、十六进制和命名实体)
|
|
83
86
|
* UnicodeToolkit.decode('Price: £10 & ©')
|
|
84
87
|
* // => 'Price: £10 & ©'
|
|
85
|
-
*
|
|
88
|
+
* @example
|
|
86
89
|
* // 空格归一化 (将 转为标准空格)
|
|
87
90
|
* UnicodeToolkit.decode('A B', true)
|
|
88
91
|
* // => 'A B' (charCodeAt 为 32 而不是 160)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.18.
|
|
2
|
+
* sculp-js v1.18.3
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { numberToHex, HEX_POOL } from './number.
|
|
8
|
-
import { randomNumber } from './random.
|
|
9
|
-
import { isString, isNumber } from './type.
|
|
7
|
+
import { numberToHex, HEX_POOL } from './number.mjs';
|
|
8
|
+
import { randomNumber } from './random.mjs';
|
|
9
|
+
import { isString, isNumber } from './type.mjs';
|
|
10
10
|
|
|
11
11
|
const padStartWithZero = (str, maxLength = 2) => String(str).padStart(maxLength, '0');
|
|
12
12
|
let safeNo = 0;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.18.
|
|
2
|
+
* sculp-js v1.18.3
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { isFunction } from './type.
|
|
8
|
-
import { pathJoin } from './path.
|
|
9
|
-
import { qsParse, qsStringify } from './qs.
|
|
7
|
+
import { isFunction } from './type.mjs';
|
|
8
|
+
import { pathJoin } from './path.mjs';
|
|
9
|
+
import { qsParse, qsStringify } from './qs.mjs';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* url 解析
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.18.
|
|
2
|
+
* sculp-js v1.18.3
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { isNullOrUnDef, isString } from './type.
|
|
7
|
+
import { isNullOrUnDef, isString } from './type.mjs';
|
|
8
8
|
|
|
9
9
|
/*
|
|
10
10
|
* @created: Saturday, 2020-04-18 14:38:23
|
|
@@ -6,18 +6,19 @@ export declare class UnicodeToolkit {
|
|
|
6
6
|
private static readonly NAMED_ENTITIES;
|
|
7
7
|
/**
|
|
8
8
|
* 编码函数
|
|
9
|
-
* @param str 原始字符串
|
|
10
|
-
* @param mode 'unicode' (\uXXXX) | 'html' ({) | 'entities' (命名实体)
|
|
11
|
-
* @param encodeAll 是否编码 ASCII 可见字符 (默认 false,仅编码非 ASCII 和特殊字符)
|
|
12
|
-
*
|
|
9
|
+
* @param {string} str 原始字符串
|
|
10
|
+
* @param {'unicode'|'html'} mode 'unicode' (\uXXXX) | 'html' ({) | 'entities' (命名实体)
|
|
11
|
+
* @param {boolean} encodeAll 是否编码 ASCII 可见字符 (默认 false,仅编码非 ASCII 和特殊字符)
|
|
12
|
+
* @returns {string} 编码后的字符串
|
|
13
|
+
* @example
|
|
13
14
|
* // Unicode 编码 (默认仅编码非 ASCII)
|
|
14
15
|
* UnicodeToolkit.encode('Hi 你好 😀')
|
|
15
|
-
* // => 'Hi
|
|
16
|
-
*
|
|
16
|
+
* // => 'Hi \u4F60\u597D \u{1F600}'
|
|
17
|
+
* @example
|
|
17
18
|
* // 全部Unicode 编码
|
|
18
19
|
* UnicodeToolkit.encode('Hi 你好 😀','unicode', true)
|
|
19
|
-
* // => '
|
|
20
|
-
*
|
|
20
|
+
* // => '\u0048\u0069\u0020\u4F60\u597D\u0020\u{1F600}'
|
|
21
|
+
* @example
|
|
21
22
|
* // HTML 实体编码
|
|
22
23
|
* UnicodeToolkit.encode('<script>', 'html',true)
|
|
23
24
|
* // => '<script>&'
|
|
@@ -25,16 +26,18 @@ export declare class UnicodeToolkit {
|
|
|
25
26
|
static encode(str: string, mode?: 'unicode' | 'html', encodeAll?: boolean): string;
|
|
26
27
|
/**
|
|
27
28
|
* 综合解码 (支持 \uXXXX, \u{XXXX}, HTML 实体, 十六进制实体)
|
|
28
|
-
* @param normalizeSpace 是否将 \u00A0 ( ) 转换为普通空格 \u0020
|
|
29
|
-
*
|
|
29
|
+
* @param {boolean} normalizeSpace 是否将 \u00A0 ( ) 转换为普通空格 \u0020
|
|
30
|
+
* @returns {string} 解码后的字符串
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
30
33
|
* // 解码 Unicode 和 Emoji
|
|
31
|
-
* UnicodeToolkit.decode('
|
|
34
|
+
* UnicodeToolkit.decode('\u4F60\u597D\u{1F680}')
|
|
32
35
|
* // => '你好🚀'
|
|
33
|
-
*
|
|
36
|
+
* @example
|
|
34
37
|
* // 解码 HTML 实体 (支持十进制、十六进制和命名实体)
|
|
35
38
|
* UnicodeToolkit.decode('Price: £10 & ©')
|
|
36
39
|
* // => 'Price: £10 & ©'
|
|
37
|
-
*
|
|
40
|
+
* @example
|
|
38
41
|
* // 空格归一化 (将 转为标准空格)
|
|
39
42
|
* UnicodeToolkit.decode('A B', true)
|
|
40
43
|
* // => 'A B' (charCodeAt 为 32 而不是 160)
|
package/dist/umd/index.min.js
CHANGED