sculp-js 1.6.1 → 1.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.
- package/README.md +12 -2
- package/lib/cjs/array.js +2 -2
- package/lib/cjs/async.js +2 -2
- package/lib/cjs/base64.js +2 -2
- package/lib/cjs/clipboard.js +2 -2
- package/lib/cjs/cookie.js +2 -2
- package/lib/cjs/date.js +2 -2
- package/lib/cjs/dom.js +2 -2
- package/lib/cjs/download.js +2 -2
- package/lib/cjs/easing.js +2 -2
- package/lib/cjs/file.js +2 -2
- package/lib/cjs/func.js +2 -2
- package/lib/cjs/index.js +26 -3
- package/lib/cjs/math.js +2 -2
- package/lib/cjs/number.js +2 -2
- package/lib/cjs/object.js +67 -20
- package/lib/cjs/path.js +2 -2
- package/lib/cjs/qs.js +2 -2
- package/lib/cjs/random.js +2 -2
- package/lib/cjs/string.js +3 -3
- package/lib/cjs/tooltip.js +2 -2
- package/lib/cjs/tree.js +10 -8
- package/lib/cjs/type.js +8 -8
- package/lib/cjs/unique.js +2 -2
- package/lib/cjs/url.js +2 -2
- package/lib/cjs/validator.js +147 -0
- package/lib/cjs/variable.js +118 -0
- package/lib/cjs/watermark.js +2 -2
- package/lib/cjs/we-decode.js +4 -4
- package/lib/es/array.js +2 -2
- package/lib/es/async.js +2 -2
- package/lib/es/base64.js +2 -2
- package/lib/es/clipboard.js +2 -2
- package/lib/es/cookie.js +2 -2
- package/lib/es/date.js +2 -2
- package/lib/es/dom.js +2 -2
- package/lib/es/download.js +2 -2
- package/lib/es/easing.js +2 -2
- package/lib/es/file.js +2 -2
- package/lib/es/func.js +2 -2
- package/lib/es/index.js +5 -3
- package/lib/es/math.js +2 -2
- package/lib/es/number.js +2 -2
- package/lib/es/object.js +67 -20
- package/lib/es/path.js +2 -2
- package/lib/es/qs.js +2 -2
- package/lib/es/random.js +2 -2
- package/lib/es/string.js +3 -3
- package/lib/es/tooltip.js +2 -2
- package/lib/es/tree.js +10 -8
- package/lib/es/type.js +8 -8
- package/lib/es/unique.js +2 -2
- package/lib/es/url.js +2 -2
- package/lib/es/validator.js +130 -0
- package/lib/es/variable.js +112 -0
- package/lib/es/watermark.js +2 -2
- package/lib/es/we-decode.js +4 -4
- package/lib/index.d.ts +154 -16
- package/lib/umd/index.js +327 -33
- package/package.json +1 -1
|
@@ -0,0 +1,118 @@
|
|
|
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 type = require('./type.js');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 去除字符串中重复字符
|
|
13
|
+
* @param {string} str
|
|
14
|
+
* @returns string
|
|
15
|
+
* @example
|
|
16
|
+
*
|
|
17
|
+
* uniqueSymbol('1a1bac');
|
|
18
|
+
* // => '1abc'
|
|
19
|
+
*/
|
|
20
|
+
function uniqueSymbol(str) {
|
|
21
|
+
return [...new Set(str.trim().split(''))].join('');
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 转义所有特殊字符
|
|
25
|
+
* @param {string} str 原字符串
|
|
26
|
+
* reference: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Guide/Regular_expressions
|
|
27
|
+
* @returns string
|
|
28
|
+
*/
|
|
29
|
+
function escapeRegExp(str) {
|
|
30
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); //$&表示整个被匹配的字符串
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 根据左右匹配符号生产解析变量(自动删除变量内的空白)
|
|
34
|
+
* @param {string} leftMatchSymbol
|
|
35
|
+
* @param {string} rightMatchSymbol
|
|
36
|
+
* @returns RegExp
|
|
37
|
+
*/
|
|
38
|
+
function parseVariableRegExp(leftMatchSymbol, rightMatchSymbol) {
|
|
39
|
+
return new RegExp(`${escapeRegExp(leftMatchSymbol.trim())}\\s*([^${escapeRegExp(uniqueSymbol(leftMatchSymbol))}${escapeRegExp(uniqueSymbol(rightMatchSymbol))}\\s]*)\\s*${rightMatchSymbol.trim()}`, 'g');
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 解析字符串的插值变量
|
|
43
|
+
* @param {string} str 字符串
|
|
44
|
+
* @param {string} leftMatchSymbol 变量左侧匹配符号,默认:{
|
|
45
|
+
* @param {string} rightMatchSymbol 变量右侧匹配符号,默认:}
|
|
46
|
+
* @returns string[]
|
|
47
|
+
* @example
|
|
48
|
+
*
|
|
49
|
+
* default match symbol {} same as /{\s*([^{}\s]*)\s*}/g
|
|
50
|
+
*/
|
|
51
|
+
function parseVarFromString(str, leftMatchSymbol = '{', rightMatchSymbol = '}') {
|
|
52
|
+
return Array.from(str.matchAll(parseVariableRegExp(leftMatchSymbol, rightMatchSymbol))).map(el => el?.[1]);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 替换字符串中的插值变量
|
|
56
|
+
* @param {string} sourceStr
|
|
57
|
+
* @param {Record<string, any>} targetObj
|
|
58
|
+
* @param {string} leftMatchSymbol 变量左侧匹配符号,默认:{
|
|
59
|
+
* @param {string} rightMatchSymbol 变量右侧匹配符号,默认:}
|
|
60
|
+
* @returns string
|
|
61
|
+
*/
|
|
62
|
+
function replaceVarFromString(sourceStr, targetObj, leftMatchSymbol = '{', rightMatchSymbol = '}') {
|
|
63
|
+
return sourceStr.replace(new RegExp(parseVariableRegExp(leftMatchSymbol, rightMatchSymbol)), function (m, p1) {
|
|
64
|
+
return type.objectHas(targetObj, p1) ? targetObj[p1] : m;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 在指定作用域中执行代码
|
|
69
|
+
* @param {string} code 要执行的代码(需包含 return 语句或表达式)
|
|
70
|
+
* @param {Object} scope 作用域对象(键值对形式的变量环境)
|
|
71
|
+
* @returns 代码执行结果
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* // 测试用例 1: 基本变量访问
|
|
75
|
+
* executeInScope("return a + b;", { a: 1, b: 2 });
|
|
76
|
+
* // 3
|
|
77
|
+
*
|
|
78
|
+
* // 测试用例 2: 支持复杂表达式和运算
|
|
79
|
+
* executeInScope(
|
|
80
|
+
* "return Array.from({ length: 3 }, (_, i) => base + i);",
|
|
81
|
+
* { base: 100 }
|
|
82
|
+
* );
|
|
83
|
+
* // [100, 101, 102]
|
|
84
|
+
*
|
|
85
|
+
* // 支持外传函数作用域执行
|
|
86
|
+
* const scope = {
|
|
87
|
+
* $: {
|
|
88
|
+
* fun: {
|
|
89
|
+
* time: {
|
|
90
|
+
* now: function () {
|
|
91
|
+
* return new Date();
|
|
92
|
+
* },
|
|
93
|
+
* },
|
|
94
|
+
* },
|
|
95
|
+
* },
|
|
96
|
+
* };
|
|
97
|
+
* executeInScope("return $.fun.time.now()", scope)
|
|
98
|
+
*/
|
|
99
|
+
function executeInScope(code, scope = {}) {
|
|
100
|
+
// 提取作用域对象的键和值
|
|
101
|
+
const keys = Object.keys(scope);
|
|
102
|
+
const values = keys.map(key => scope[key]);
|
|
103
|
+
try {
|
|
104
|
+
// 动态创建函数,将作用域的键作为参数,代码作为函数体
|
|
105
|
+
const func = new Function(...keys, `return (() => { ${code} })()`);
|
|
106
|
+
// 调用函数并传入作用域的值
|
|
107
|
+
return func(...values);
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
throw new Error(`代码执行失败: ${error.message}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
exports.escapeRegExp = escapeRegExp;
|
|
115
|
+
exports.executeInScope = executeInScope;
|
|
116
|
+
exports.parseVarFromString = parseVarFromString;
|
|
117
|
+
exports.replaceVarFromString = replaceVarFromString;
|
|
118
|
+
exports.uniqueSymbol = uniqueSymbol;
|
package/lib/cjs/watermark.js
CHANGED
package/lib/cjs/we-decode.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
3
|
-
* (c) 2023-
|
|
2
|
+
* sculp-js v1.7.0
|
|
3
|
+
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ const b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3
|
|
|
12
12
|
/**
|
|
13
13
|
* 字符串编码成Base64 (适用于任何环境,包括小程序)
|
|
14
14
|
* @param {string} string
|
|
15
|
-
* @
|
|
15
|
+
* @returns {string}
|
|
16
16
|
*/
|
|
17
17
|
function weBtoa(string) {
|
|
18
18
|
// 同window.btoa: 字符串编码成Base64
|
|
@@ -34,7 +34,7 @@ function weBtoa(string) {
|
|
|
34
34
|
/**
|
|
35
35
|
* Base64解码为原始字符串(适用于任何环境,包括小程序)
|
|
36
36
|
* @param {string} string
|
|
37
|
-
* @
|
|
37
|
+
* @returns {string}
|
|
38
38
|
*/
|
|
39
39
|
function weAtob(string) {
|
|
40
40
|
// 同window.atob: Base64解码为原始字符串
|
package/lib/es/array.js
CHANGED
package/lib/es/async.js
CHANGED
package/lib/es/base64.js
CHANGED
package/lib/es/clipboard.js
CHANGED
package/lib/es/cookie.js
CHANGED
package/lib/es/date.js
CHANGED
package/lib/es/dom.js
CHANGED
package/lib/es/download.js
CHANGED
package/lib/es/easing.js
CHANGED
package/lib/es/file.js
CHANGED
package/lib/es/func.js
CHANGED
package/lib/es/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
3
|
-
* (c) 2023-
|
|
2
|
+
* sculp-js v1.7.0
|
|
3
|
+
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -24,7 +24,9 @@ export { STRING_POOL, randomNumber, randomString, randomUuid } from './random.js
|
|
|
24
24
|
export { HEX_POOL, formatNumber, numberAbbr, numberToHex } from './number.js';
|
|
25
25
|
export { UNIQUE_NUMBER_SAFE_LENGTH, uniqueNumber, uniqueString } from './unique.js';
|
|
26
26
|
export { tooltipEvent } from './tooltip.js';
|
|
27
|
-
export { buildTree, flatTree, forEachDeep,
|
|
27
|
+
export { buildTree, flatTree, forEachDeep, formatTree, fuzzySearchTree, mapDeep, searchTreeById } from './tree.js';
|
|
28
28
|
export { add, divide, multiply, strip, subtract } from './math.js';
|
|
29
29
|
export { weAtob, weBtoa } from './we-decode.js';
|
|
30
30
|
export { decodeFromBase64, encodeToBase64 } from './base64.js';
|
|
31
|
+
export { EMAIL_REGEX, HTTP_URL_REGEX, IPV4_REGEX, IPV6_REGEX, PHONE_REGEX, URL_REGEX, isDigit, isEmail, isFloat, isIdNo, isInteger, isIpV4, isIpV6, isNumerical, isPhone, isUrl } from './validator.js';
|
|
32
|
+
export { escapeRegExp, executeInScope, parseVarFromString, replaceVarFromString, uniqueSymbol } from './variable.js';
|
package/lib/es/math.js
CHANGED
package/lib/es/number.js
CHANGED
package/lib/es/object.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
3
|
-
* (c) 2023-
|
|
2
|
+
* sculp-js v1.7.0
|
|
3
|
+
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -196,26 +196,73 @@ function objectGet(obj, path, strict = false) {
|
|
|
196
196
|
}
|
|
197
197
|
/**
|
|
198
198
|
* 深拷贝堪称完全体 即:任何类型的数据都会被深拷贝
|
|
199
|
-
* @param {
|
|
199
|
+
* @param {T} source
|
|
200
200
|
* @param {WeakMap} map
|
|
201
|
-
* @returns {
|
|
201
|
+
* @returns {T}
|
|
202
202
|
*/
|
|
203
|
-
function cloneDeep(
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
|
|
203
|
+
function cloneDeep(source, map = new WeakMap()) {
|
|
204
|
+
// 处理原始类型(非对象/数组)和 null/undefined
|
|
205
|
+
if (source === null || typeof source !== 'object') {
|
|
206
|
+
return source;
|
|
207
|
+
}
|
|
208
|
+
// 处理循环引用
|
|
209
|
+
if (map.has(source)) {
|
|
210
|
+
return map.get(source);
|
|
211
|
+
}
|
|
212
|
+
// 处理 Date 类型
|
|
213
|
+
if (source instanceof Date) {
|
|
214
|
+
const copy = new Date(source.getTime());
|
|
215
|
+
map.set(source, copy);
|
|
216
|
+
return copy;
|
|
217
|
+
}
|
|
218
|
+
// 处理 RegExp 类型
|
|
219
|
+
if (source instanceof RegExp) {
|
|
220
|
+
const copy = new RegExp(source.source, source.flags);
|
|
221
|
+
map.set(source, copy);
|
|
222
|
+
return copy;
|
|
223
|
+
}
|
|
224
|
+
// 处理数组类型
|
|
225
|
+
if (Array.isArray(source)) {
|
|
226
|
+
const copy = [];
|
|
227
|
+
map.set(source, copy);
|
|
228
|
+
for (const item of source) {
|
|
229
|
+
copy.push(cloneDeep(item, map));
|
|
230
|
+
}
|
|
231
|
+
return copy;
|
|
232
|
+
}
|
|
233
|
+
// 处理 Map 类型
|
|
234
|
+
if (source instanceof Map) {
|
|
235
|
+
const copy = new Map();
|
|
236
|
+
map.set(source, copy);
|
|
237
|
+
source.forEach((value, key) => {
|
|
238
|
+
copy.set(cloneDeep(key, map), cloneDeep(value, map));
|
|
239
|
+
});
|
|
240
|
+
return copy;
|
|
241
|
+
}
|
|
242
|
+
// 处理 Set 类型
|
|
243
|
+
if (source instanceof Set) {
|
|
244
|
+
const copy = new Set();
|
|
245
|
+
map.set(source, copy);
|
|
246
|
+
source.forEach(value => {
|
|
247
|
+
copy.add(cloneDeep(value, map));
|
|
248
|
+
});
|
|
249
|
+
return copy;
|
|
250
|
+
}
|
|
251
|
+
// 处理 ArrayBuffer 类型
|
|
252
|
+
if (source instanceof ArrayBuffer) {
|
|
253
|
+
const copy = new ArrayBuffer(source.byteLength);
|
|
254
|
+
new Uint8Array(copy).set(new Uint8Array(source));
|
|
255
|
+
map.set(source, copy);
|
|
256
|
+
return copy;
|
|
257
|
+
}
|
|
258
|
+
// 处理普通对象(包括原型链继承)
|
|
259
|
+
const copy = Object.create(Object.getPrototypeOf(source));
|
|
260
|
+
map.set(source, copy);
|
|
261
|
+
for (const key of Reflect.ownKeys(source)) {
|
|
262
|
+
const value = source[key];
|
|
263
|
+
copy[key] = cloneDeep(value, map);
|
|
264
|
+
}
|
|
265
|
+
return copy;
|
|
219
266
|
}
|
|
220
267
|
|
|
221
268
|
export { cloneDeep, isPlainObject, objectAssign, objectEach, objectEachAsync, objectFill, objectGet, objectMap, objectAssign as objectMerge, objectOmit, objectPick };
|
package/lib/es/path.js
CHANGED
package/lib/es/qs.js
CHANGED
package/lib/es/random.js
CHANGED
package/lib/es/string.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
3
|
-
* (c) 2023-
|
|
2
|
+
* sculp-js v1.7.0
|
|
3
|
+
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -123,7 +123,7 @@ const stringFill = (length, value = ' ') => new Array(length).fill(value).join('
|
|
|
123
123
|
/**
|
|
124
124
|
* 解析URL查询参数
|
|
125
125
|
* @param {string} searchStr
|
|
126
|
-
* @
|
|
126
|
+
* @returns {Record<string, string | string[]>}
|
|
127
127
|
*/
|
|
128
128
|
function parseQueryParams(searchStr = location.search) {
|
|
129
129
|
const queryObj = {};
|
package/lib/es/tooltip.js
CHANGED
package/lib/es/tree.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
3
|
-
* (c) 2023-
|
|
2
|
+
* sculp-js v1.7.0
|
|
3
|
+
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { objectOmit } from './object.js';
|
|
8
|
+
|
|
7
9
|
const defaultFieldOptions = { keyField: 'key', childField: 'children', pidField: 'pid' };
|
|
8
10
|
const defaultSearchTreeOptions = {
|
|
9
11
|
childField: 'children',
|
|
@@ -72,7 +74,7 @@ function forEachDeep(tree, iterator, children = 'children', isReverse = false) {
|
|
|
72
74
|
* @param {boolean} isReverse 是否反向遍历
|
|
73
75
|
* @returns {any[]} 新的一棵树
|
|
74
76
|
*/
|
|
75
|
-
function
|
|
77
|
+
function mapDeep(tree, iterator, children = 'children', isReverse = false) {
|
|
76
78
|
let isBreak = false;
|
|
77
79
|
const newTree = [];
|
|
78
80
|
const walk = (arr, parent, newTree, level = 0) => {
|
|
@@ -89,7 +91,7 @@ function forEachMap(tree, iterator, children = 'children', isReverse = false) {
|
|
|
89
91
|
else if (re === true) {
|
|
90
92
|
continue;
|
|
91
93
|
}
|
|
92
|
-
newTree.push(re);
|
|
94
|
+
newTree.push(objectOmit(re, [children]));
|
|
93
95
|
// @ts-ignore
|
|
94
96
|
if (arr[i] && Array.isArray(arr[i][children])) {
|
|
95
97
|
newTree[newTree.length - 1][children] = [];
|
|
@@ -115,7 +117,7 @@ function forEachMap(tree, iterator, children = 'children', isReverse = false) {
|
|
|
115
117
|
else if (re === true) {
|
|
116
118
|
continue;
|
|
117
119
|
}
|
|
118
|
-
newTree.push(re);
|
|
120
|
+
newTree.push(objectOmit(re, [children]));
|
|
119
121
|
// @ts-ignore
|
|
120
122
|
if (arr[i] && Array.isArray(arr[i][children])) {
|
|
121
123
|
newTree[newTree.length - 1][children] = [];
|
|
@@ -278,7 +280,7 @@ function formatTree(list, options = defaultFieldOptions) {
|
|
|
278
280
|
* 树形结构转扁平化
|
|
279
281
|
* @param {any} treeList
|
|
280
282
|
* @param {IFieldOptions} options
|
|
281
|
-
* @
|
|
283
|
+
* @returns {*}
|
|
282
284
|
*/
|
|
283
285
|
function flatTree(treeList, options = defaultFieldOptions) {
|
|
284
286
|
const { childField, keyField, pidField } = options;
|
|
@@ -304,7 +306,7 @@ function flatTree(treeList, options = defaultFieldOptions) {
|
|
|
304
306
|
* @param {any[]} nodes
|
|
305
307
|
* @param {string} query
|
|
306
308
|
* @param {ISearchTreeOpts} options
|
|
307
|
-
* @
|
|
309
|
+
* @returns {any[]}
|
|
308
310
|
*/
|
|
309
311
|
function fuzzySearchTree(nodes, query, options = defaultSearchTreeOptions) {
|
|
310
312
|
const result = [];
|
|
@@ -347,4 +349,4 @@ function fuzzySearchTree(nodes, query, options = defaultSearchTreeOptions) {
|
|
|
347
349
|
return result;
|
|
348
350
|
}
|
|
349
351
|
|
|
350
|
-
export { buildTree, flatTree, forEachDeep,
|
|
352
|
+
export { buildTree, flatTree, forEachDeep, formatTree, fuzzySearchTree, mapDeep, searchTreeById };
|
package/lib/es/type.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
3
|
-
* (c) 2023-
|
|
2
|
+
* sculp-js v1.7.0
|
|
3
|
+
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -64,7 +64,7 @@ const isRegExp = (any) => typeIs(any) === 'RegExp';
|
|
|
64
64
|
/**
|
|
65
65
|
* 判断一个字符串是否为有效的 JSON, 若有效则返回有效的JSON对象,否则false
|
|
66
66
|
* @param {string} str
|
|
67
|
-
* @
|
|
67
|
+
* @returns {Object | boolean}
|
|
68
68
|
*/
|
|
69
69
|
function isJsonString(str) {
|
|
70
70
|
try {
|
|
@@ -89,19 +89,19 @@ function isJsonString(str) {
|
|
|
89
89
|
* @returns {boolean} Returns `true` if `value` is empty, else `false`.
|
|
90
90
|
* @example
|
|
91
91
|
*
|
|
92
|
-
*
|
|
92
|
+
* isEmpty(null);
|
|
93
93
|
* // => true
|
|
94
94
|
*
|
|
95
|
-
*
|
|
95
|
+
* isEmpty(true);
|
|
96
96
|
* // => true
|
|
97
97
|
*
|
|
98
|
-
*
|
|
98
|
+
* isEmpty(1);
|
|
99
99
|
* // => true
|
|
100
100
|
*
|
|
101
|
-
*
|
|
101
|
+
* isEmpty([1, 2, 3]);
|
|
102
102
|
* // => false
|
|
103
103
|
*
|
|
104
|
-
*
|
|
104
|
+
* isEmpty({ 'a': 1 });
|
|
105
105
|
* // => false
|
|
106
106
|
*/
|
|
107
107
|
function isEmpty(value) {
|
package/lib/es/unique.js
CHANGED
package/lib/es/url.js
CHANGED