sculp-js 1.5.1 → 1.7.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.
Files changed (61) hide show
  1. package/README.md +10 -1
  2. package/lib/cjs/array.js +2 -21
  3. package/lib/cjs/async.js +2 -2
  4. package/lib/cjs/base64.js +62 -0
  5. package/lib/cjs/clipboard.js +2 -2
  6. package/lib/cjs/cookie.js +2 -2
  7. package/lib/cjs/date.js +2 -3
  8. package/lib/cjs/dom.js +2 -2
  9. package/lib/cjs/download.js +2 -2
  10. package/lib/cjs/easing.js +2 -2
  11. package/lib/cjs/file.js +2 -2
  12. package/lib/cjs/func.js +3 -3
  13. package/lib/cjs/index.js +37 -4
  14. package/lib/cjs/math.js +88 -0
  15. package/lib/cjs/number.js +2 -2
  16. package/lib/cjs/object.js +10 -20
  17. package/lib/cjs/path.js +2 -2
  18. package/lib/cjs/qs.js +2 -2
  19. package/lib/cjs/random.js +2 -2
  20. package/lib/cjs/string.js +3 -3
  21. package/lib/cjs/tooltip.js +2 -2
  22. package/lib/cjs/tree.js +4 -4
  23. package/lib/cjs/type.js +69 -3
  24. package/lib/cjs/unique.js +2 -2
  25. package/lib/cjs/url.js +2 -2
  26. package/lib/cjs/validator.js +147 -0
  27. package/lib/cjs/variable.js +118 -0
  28. package/lib/cjs/watermark.js +2 -2
  29. package/lib/cjs/we-decode.js +4 -4
  30. package/lib/es/array.js +3 -21
  31. package/lib/es/async.js +2 -2
  32. package/lib/es/base64.js +59 -0
  33. package/lib/es/clipboard.js +2 -2
  34. package/lib/es/cookie.js +2 -2
  35. package/lib/es/date.js +2 -3
  36. package/lib/es/dom.js +2 -2
  37. package/lib/es/download.js +2 -2
  38. package/lib/es/easing.js +2 -2
  39. package/lib/es/file.js +2 -2
  40. package/lib/es/func.js +3 -3
  41. package/lib/es/index.js +9 -5
  42. package/lib/es/math.js +82 -0
  43. package/lib/es/number.js +2 -2
  44. package/lib/es/object.js +9 -18
  45. package/lib/es/path.js +2 -2
  46. package/lib/es/qs.js +2 -2
  47. package/lib/es/random.js +2 -2
  48. package/lib/es/string.js +3 -3
  49. package/lib/es/tooltip.js +2 -2
  50. package/lib/es/tree.js +4 -4
  51. package/lib/es/type.js +67 -4
  52. package/lib/es/unique.js +2 -2
  53. package/lib/es/url.js +2 -2
  54. package/lib/es/validator.js +130 -0
  55. package/lib/es/variable.js +112 -0
  56. package/lib/es/watermark.js +2 -2
  57. package/lib/es/we-decode.js +4 -4
  58. package/lib/index.d.ts +236 -21
  59. package/lib/tsdoc-metadata.json +11 -0
  60. package/lib/umd/index.js +571 -155
  61. package/package.json +2 -2
package/README.md CHANGED
@@ -9,7 +9,16 @@
9
9
 
10
10
  [API文档](https://chandq.github.io/sculp-js/)
11
11
 
12
- > TS + Rollup, native implementation, without relying on any third-party libraries, outputs products of three module modes: ESM, CJS, and UMD
12
+ > TS + Rollup, native implementation, without relying on any third-party libraries, outputs products of three module modes: ESM, CJS, and UMD. sculp-js only used to Web environment, @sculp/core can be used to Web、Node.js、Mini Program.
13
+
14
+ ## Quickstart
15
+
16
+ - Via CDN: `<script src="https://unpkg.com/sculp-js"></script>`
17
+ - Via npm:
18
+
19
+ ```js
20
+ npm i sculp-js
21
+ ```
13
22
 
14
23
  ## Features
15
24
 
package/lib/cjs/array.js CHANGED
@@ -1,29 +1,11 @@
1
1
  /*!
2
- * sculp-js v1.5.0
3
- * (c) 2023-2024 chandq
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
7
7
  'use strict';
8
8
 
9
- var object = require('./object.js');
10
- var type = require('./type.js');
11
-
12
- /**
13
- * 判断一个对象是否为类数组
14
- *
15
- * @param any
16
- * @returns {boolean}
17
- */
18
- function arrayLike(any) {
19
- if (type.isArray(any))
20
- return true;
21
- if (type.isString(any))
22
- return true;
23
- if (!type.isObject(any))
24
- return false;
25
- return object.objectHas(any, 'length');
26
- }
27
9
  /**
28
10
  * 遍历数组,返回 false 中断遍历(支持continue和break操作)
29
11
  *
@@ -113,5 +95,4 @@ function arrayRemove(array, expect) {
113
95
  exports.arrayEach = arrayEach;
114
96
  exports.arrayEachAsync = arrayEachAsync;
115
97
  exports.arrayInsertBefore = arrayInsertBefore;
116
- exports.arrayLike = arrayLike;
117
98
  exports.arrayRemove = arrayRemove;
package/lib/cjs/async.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * sculp-js v1.5.0
3
- * (c) 2023-2024 chandq
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
@@ -0,0 +1,62 @@
1
+ /*!
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
+ * Released under the MIT License.
5
+ */
6
+
7
+ 'use strict';
8
+
9
+ var func = require('./func.js');
10
+ var type = require('./type.js');
11
+ var weDecode = require('./we-decode.js');
12
+
13
+ function stringToUint8Array(str) {
14
+ const utf8 = encodeURIComponent(str); // 将字符串转换为 UTF-8 编码
15
+ const uint8Array = new Uint8Array(utf8.length); // 创建 Uint8Array
16
+ for (let i = 0; i < utf8.length; i++) {
17
+ uint8Array[i] = utf8.charCodeAt(i); // 填充 Uint8Array
18
+ }
19
+ return uint8Array;
20
+ }
21
+ function uint8ArrayToString(uint8Array) {
22
+ const utf8 = String.fromCharCode.apply(null, uint8Array); // 将 Uint8Array 转为字符串
23
+ return decodeURIComponent(utf8); // 将 UTF-8 字符串解码回正常字符串
24
+ }
25
+ /**
26
+ * 将base64编码的字符串转换为原始字符串,包括对中文内容的处理(高性能,且支持Web、Node、小程序等任意平台)
27
+ * @param base64 base64编码的字符串
28
+ * @returns 原始字符串,包括中文内容
29
+ */
30
+ function decodeFromBase64(base64) {
31
+ const binaryString = !type.isNullOrUnDef(func.getGlobal('atob')) ? func.getGlobal('atob')(base64) : weDecode.weAtob(base64);
32
+ const len = binaryString.length;
33
+ const bytes = new Uint8Array(len);
34
+ for (let i = 0; i < len; i++) {
35
+ bytes[i] = binaryString.charCodeAt(i);
36
+ }
37
+ // 使用TextDecoder将Uint8Array转换为原始字符串,包括中文内容
38
+ return !type.isNullOrUnDef(func.getGlobal('TextDecoder'))
39
+ ? new (func.getGlobal('TextDecoder'))('utf-8').decode(bytes)
40
+ : uint8ArrayToString(bytes);
41
+ }
42
+ /**
43
+ * 将原始字符串,包括中文内容,转换为base64编码的字符串(高性能,且支持Web、Node、小程序等任意平台)
44
+ * @param rawStr 原始字符串,包括中文内容
45
+ * @returns base64编码的字符串
46
+ */
47
+ function encodeToBase64(rawStr) {
48
+ const utf8Array = !type.isNullOrUnDef(func.getGlobal('TextEncoder'))
49
+ ? new (func.getGlobal('TextEncoder'))().encode(rawStr)
50
+ : stringToUint8Array(rawStr);
51
+ // 将 Uint8Array 转换为二进制字符串
52
+ let binaryString = '';
53
+ const len = utf8Array.length;
54
+ for (let i = 0; i < len; i++) {
55
+ binaryString += String.fromCharCode(utf8Array[i]);
56
+ }
57
+ // 将二进制字符串转换为base64编码的字符串
58
+ return !type.isNullOrUnDef(func.getGlobal('btoa')) ? func.getGlobal('btoa')(binaryString) : weDecode.weBtoa(binaryString);
59
+ }
60
+
61
+ exports.decodeFromBase64 = decodeFromBase64;
62
+ exports.encodeToBase64 = encodeToBase64;
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * sculp-js v1.5.0
3
- * (c) 2023-2024 chandq
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
package/lib/cjs/cookie.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * sculp-js v1.5.0
3
- * (c) 2023-2024 chandq
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
package/lib/cjs/date.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * sculp-js v1.5.0
3
- * (c) 2023-2024 chandq
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
@@ -129,7 +129,6 @@ function dateToEnd(value) {
129
129
  * - DD:日
130
130
  * - dd: 日
131
131
  * - HH:时(24 小时制)
132
- * - hh:时(12 小时制)
133
132
  * - mm:分
134
133
  * - ss:秒
135
134
  * - SSS:毫秒
package/lib/cjs/dom.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * sculp-js v1.5.0
3
- * (c) 2023-2024 chandq
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * sculp-js v1.5.0
3
- * (c) 2023-2024 chandq
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
package/lib/cjs/easing.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * sculp-js v1.5.0
3
- * (c) 2023-2024 chandq
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
package/lib/cjs/file.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * sculp-js v1.5.0
3
- * (c) 2023-2024 chandq
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
package/lib/cjs/func.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * sculp-js v1.5.0
3
- * (c) 2023-2024 chandq
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
@@ -126,7 +126,7 @@ function setGlobal(key, val) {
126
126
  throw new SyntaxError('当前环境下无法设置全局属性');
127
127
  }
128
128
  /**
129
- * 设置全局变量
129
+ * 获取全局变量
130
130
  * @param {string | number | symbol} key
131
131
  * @param val
132
132
  */
package/lib/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * sculp-js v1.5.0
3
- * (c) 2023-2024 chandq
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
@@ -27,14 +27,17 @@ var number = require('./number.js');
27
27
  var unique = require('./unique.js');
28
28
  var tooltip = require('./tooltip.js');
29
29
  var tree = require('./tree.js');
30
+ var math = require('./math.js');
30
31
  var weDecode = require('./we-decode.js');
32
+ var base64 = require('./base64.js');
33
+ var validator = require('./validator.js');
34
+ var variable = require('./variable.js');
31
35
 
32
36
 
33
37
 
34
38
  exports.arrayEach = array.arrayEach;
35
39
  exports.arrayEachAsync = array.arrayEachAsync;
36
40
  exports.arrayInsertBefore = array.arrayInsertBefore;
37
- exports.arrayLike = array.arrayLike;
38
41
  exports.arrayRemove = array.arrayRemove;
39
42
  exports.copyText = clipboard.copyText;
40
43
  exports.cookieDel = cookie.cookieDel;
@@ -69,7 +72,6 @@ exports.objectEach = object.objectEach;
69
72
  exports.objectEachAsync = object.objectEachAsync;
70
73
  exports.objectFill = object.objectFill;
71
74
  exports.objectGet = object.objectGet;
72
- exports.objectHas = object.objectHas;
73
75
  exports.objectMap = object.objectMap;
74
76
  exports.objectMerge = object.objectAssign;
75
77
  exports.objectOmit = object.objectOmit;
@@ -88,10 +90,12 @@ exports.stringEscapeHtml = string.stringEscapeHtml;
88
90
  exports.stringFill = string.stringFill;
89
91
  exports.stringFormat = string.stringFormat;
90
92
  exports.stringKebabCase = string.stringKebabCase;
93
+ exports.arrayLike = type.arrayLike;
91
94
  exports.isArray = type.isArray;
92
95
  exports.isBigInt = type.isBigInt;
93
96
  exports.isBoolean = type.isBoolean;
94
97
  exports.isDate = type.isDate;
98
+ exports.isEmpty = type.isEmpty;
95
99
  exports.isError = type.isError;
96
100
  exports.isFunction = type.isFunction;
97
101
  exports.isJsonString = type.isJsonString;
@@ -105,6 +109,7 @@ exports.isRegExp = type.isRegExp;
105
109
  exports.isString = type.isString;
106
110
  exports.isSymbol = type.isSymbol;
107
111
  exports.isUndefined = type.isUndefined;
112
+ exports.objectHas = type.objectHas;
108
113
  exports.typeIs = type.typeIs;
109
114
  exports.urlDelParams = url.urlDelParams;
110
115
  exports.urlParse = url.urlParse;
@@ -140,5 +145,33 @@ exports.forEachMap = tree.forEachMap;
140
145
  exports.formatTree = tree.formatTree;
141
146
  exports.fuzzySearchTree = tree.fuzzySearchTree;
142
147
  exports.searchTreeById = tree.searchTreeById;
148
+ exports.add = math.add;
149
+ exports.divide = math.divide;
150
+ exports.multiply = math.multiply;
151
+ exports.strip = math.strip;
152
+ exports.subtract = math.subtract;
143
153
  exports.weAtob = weDecode.weAtob;
144
154
  exports.weBtoa = weDecode.weBtoa;
155
+ exports.decodeFromBase64 = base64.decodeFromBase64;
156
+ exports.encodeToBase64 = base64.encodeToBase64;
157
+ exports.EMAIL_REGEX = validator.EMAIL_REGEX;
158
+ exports.HTTP_URL_REGEX = validator.HTTP_URL_REGEX;
159
+ exports.IPV4_REGEX = validator.IPV4_REGEX;
160
+ exports.IPV6_REGEX = validator.IPV6_REGEX;
161
+ exports.PHONE_REGEX = validator.PHONE_REGEX;
162
+ exports.URL_REGEX = validator.URL_REGEX;
163
+ exports.isDigit = validator.isDigit;
164
+ exports.isEmail = validator.isEmail;
165
+ exports.isFloat = validator.isFloat;
166
+ exports.isIdNo = validator.isIdNo;
167
+ exports.isInteger = validator.isInteger;
168
+ exports.isIpV4 = validator.isIpV4;
169
+ exports.isIpV6 = validator.isIpV6;
170
+ exports.isNumerical = validator.isNumerical;
171
+ exports.isPhone = validator.isPhone;
172
+ exports.isUrl = validator.isUrl;
173
+ exports.escapeRegExp = variable.escapeRegExp;
174
+ exports.executeInScope = variable.executeInScope;
175
+ exports.parseVarFromString = variable.parseVarFromString;
176
+ exports.replaceVarFromString = variable.replaceVarFromString;
177
+ exports.uniqueSymbol = variable.uniqueSymbol;
@@ -0,0 +1,88 @@
1
+ /*!
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
+ * Released under the MIT License.
5
+ */
6
+
7
+ 'use strict';
8
+
9
+ /**
10
+ * 数值安全乘法
11
+ * @param arg1 数值1
12
+ * @param arg2 数值2
13
+ */
14
+ const multiply = (arg1, arg2) => {
15
+ let m = 0;
16
+ const s1 = arg1.toString();
17
+ const s2 = arg2.toString();
18
+ if (s1.split('.')[1] !== undefined)
19
+ m += s1.split('.')[1].length;
20
+ if (s2.split('.')[1] !== undefined)
21
+ m += s2.split('.')[1].length;
22
+ return (Number(s1.replace('.', '')) * Number(s2.replace('.', ''))) / Math.pow(10, m);
23
+ };
24
+ /**
25
+ * 数值安全加法
26
+ * @param arg1 数值1
27
+ * @param arg2 数值2
28
+ */
29
+ const add = (arg1, arg2) => {
30
+ let r1 = 0;
31
+ let r2 = 0;
32
+ let m = 0;
33
+ try {
34
+ r1 = arg1.toString().split('.')[1].length;
35
+ }
36
+ catch (e) {
37
+ r1 = 0;
38
+ }
39
+ try {
40
+ r2 = arg2.toString().split('.')[1].length;
41
+ }
42
+ catch (e) {
43
+ r2 = 0;
44
+ }
45
+ m = 10 ** Math.max(r1, r2);
46
+ return (multiply(arg1, m) + multiply(arg2, m)) / m;
47
+ };
48
+ /**
49
+ * 数值安全减法
50
+ * @param arg1 数值1
51
+ * @param arg2 数值2
52
+ */
53
+ const subtract = (arg1, arg2) => add(arg1, -arg2);
54
+ /**
55
+ * 数值安全除法
56
+ * @param arg1 数值1
57
+ * @param arg2 数值2
58
+ */
59
+ const divide = (arg1, arg2) => {
60
+ let t1 = 0;
61
+ let t2 = 0;
62
+ let r1 = 0;
63
+ let r2 = 0;
64
+ if (arg1.toString().split('.')[1] !== undefined)
65
+ t1 = arg1.toString().split('.')[1].length;
66
+ if (arg2.toString().split('.')[1] !== undefined)
67
+ t2 = arg2.toString().split('.')[1].length;
68
+ r1 = Number(arg1.toString().replace('.', ''));
69
+ r2 = Number(arg2.toString().replace('.', ''));
70
+ return (r1 / r2) * Math.pow(10, t2 - t1);
71
+ };
72
+ /**
73
+ * Correct the given number to specifying significant digits.
74
+ *
75
+ * @param num The input number
76
+ * @param precision An integer specifying the number of significant digits
77
+ *
78
+ * @example strip(0.09999999999999998) === 0.1 // true
79
+ */
80
+ function strip(num, precision = 15) {
81
+ return +parseFloat(Number(num).toPrecision(precision));
82
+ }
83
+
84
+ exports.add = add;
85
+ exports.divide = divide;
86
+ exports.multiply = multiply;
87
+ exports.strip = strip;
88
+ exports.subtract = subtract;
package/lib/cjs/number.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * sculp-js v1.5.0
3
- * (c) 2023-2024 chandq
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
package/lib/cjs/object.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * sculp-js v1.5.0
3
- * (c) 2023-2024 chandq
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
@@ -23,15 +23,6 @@ const isPlainObject = (obj) => {
23
23
  // 是否对象直接实例
24
24
  return proto === Object.prototype;
25
25
  };
26
- /**
27
- * 判断对象内是否有该静态属性
28
- * @param {object} obj
29
- * @param {string} key
30
- * @returns {boolean}
31
- */
32
- function objectHas(obj, key) {
33
- return Object.prototype.hasOwnProperty.call(obj, key);
34
- }
35
26
  /**
36
27
  * 遍历对象,返回 false 中断遍历
37
28
  * @param {O} obj
@@ -39,7 +30,7 @@ function objectHas(obj, key) {
39
30
  */
40
31
  function objectEach(obj, iterator) {
41
32
  for (const key in obj) {
42
- if (!objectHas(obj, key))
33
+ if (!type.objectHas(obj, key))
43
34
  continue;
44
35
  if (iterator(obj[key], key) === false)
45
36
  break;
@@ -52,7 +43,7 @@ function objectEach(obj, iterator) {
52
43
  */
53
44
  async function objectEachAsync(obj, iterator) {
54
45
  for (const key in obj) {
55
- if (!objectHas(obj, key))
46
+ if (!type.objectHas(obj, key))
56
47
  continue;
57
48
  if ((await iterator(obj[key], key)) === false)
58
49
  break;
@@ -67,7 +58,7 @@ async function objectEachAsync(obj, iterator) {
67
58
  function objectMap(obj, iterator) {
68
59
  const obj2 = {};
69
60
  for (const key in obj) {
70
- if (!objectHas(obj, key))
61
+ if (!type.objectHas(obj, key))
71
62
  continue;
72
63
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
73
64
  obj2[key] = iterator(obj[key], key);
@@ -185,23 +176,23 @@ function objectGet(obj, path, strict = false) {
185
176
  let i = 0;
186
177
  for (let len = keyArr.length; i < len - 1; ++i) {
187
178
  const key = keyArr[i];
188
- if (key in tempObj) {
189
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
179
+ if (type.isNumber(Number(key)) && Array.isArray(tempObj)) {
180
+ tempObj = tempObj[key];
181
+ }
182
+ else if (type.isObject(tempObj) && type.objectHas(tempObj, key)) {
190
183
  tempObj = tempObj[key];
191
184
  }
192
185
  else {
193
186
  tempObj = undefined;
194
187
  if (strict) {
195
- throw new Error('[berry/js-utils/object] objectGet path 路径不正确');
188
+ throw new Error('[Object] objectGet path 路径不正确');
196
189
  }
197
190
  break;
198
191
  }
199
192
  }
200
193
  return {
201
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
202
194
  p: tempObj,
203
195
  k: tempObj ? keyArr[i] : undefined,
204
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
205
196
  v: tempObj ? tempObj[keyArr[i]] : undefined
206
197
  };
207
198
  }
@@ -236,7 +227,6 @@ exports.objectEach = objectEach;
236
227
  exports.objectEachAsync = objectEachAsync;
237
228
  exports.objectFill = objectFill;
238
229
  exports.objectGet = objectGet;
239
- exports.objectHas = objectHas;
240
230
  exports.objectMap = objectMap;
241
231
  exports.objectMerge = objectAssign;
242
232
  exports.objectOmit = objectOmit;
package/lib/cjs/path.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * sculp-js v1.5.0
3
- * (c) 2023-2024 chandq
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
package/lib/cjs/qs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * sculp-js v1.5.0
3
- * (c) 2023-2024 chandq
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
package/lib/cjs/random.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * sculp-js v1.5.0
3
- * (c) 2023-2024 chandq
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
package/lib/cjs/string.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * sculp-js v1.5.0
3
- * (c) 2023-2024 chandq
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
@@ -125,7 +125,7 @@ const stringFill = (length, value = ' ') => new Array(length).fill(value).join('
125
125
  /**
126
126
  * 解析URL查询参数
127
127
  * @param {string} searchStr
128
- * @return {Record<string, string | string[]>}
128
+ * @returns {Record<string, string | string[]>}
129
129
  */
130
130
  function parseQueryParams(searchStr = location.search) {
131
131
  const queryObj = {};
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * sculp-js v1.5.0
3
- * (c) 2023-2024 chandq
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
package/lib/cjs/tree.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * sculp-js v1.5.0
3
- * (c) 2023-2024 chandq
2
+ * sculp-js v1.7.0
3
+ * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
@@ -280,7 +280,7 @@ function formatTree(list, options = defaultFieldOptions) {
280
280
  * 树形结构转扁平化
281
281
  * @param {any} treeList
282
282
  * @param {IFieldOptions} options
283
- * @return {*}
283
+ * @returns {*}
284
284
  */
285
285
  function flatTree(treeList, options = defaultFieldOptions) {
286
286
  const { childField, keyField, pidField } = options;
@@ -306,7 +306,7 @@ function flatTree(treeList, options = defaultFieldOptions) {
306
306
  * @param {any[]} nodes
307
307
  * @param {string} query
308
308
  * @param {ISearchTreeOpts} options
309
- * @return {any[]}
309
+ * @returns {any[]}
310
310
  */
311
311
  function fuzzySearchTree(nodes, query, options = defaultSearchTreeOptions) {
312
312
  const result = [];