sculp-js 1.18.3 → 1.19.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.
- package/README.md +83 -6
- package/dist/cjs/array.cjs +10 -2
- package/dist/cjs/async.cjs +8 -2
- package/dist/cjs/base64.cjs +9 -2
- package/dist/cjs/clipboard.cjs +7 -2
- package/dist/cjs/cloneDeep.cjs +6 -2
- package/dist/cjs/cookie.cjs +8 -2
- package/dist/cjs/date.cjs +12 -2
- package/dist/cjs/dom.cjs +13 -2
- package/dist/cjs/download.cjs +10 -2
- package/dist/cjs/file.cjs +8 -2
- package/dist/cjs/func.cjs +10 -2
- package/dist/cjs/index.cjs +35 -3
- package/dist/cjs/isEqual.cjs +6 -2
- package/dist/cjs/math.cjs +10 -2
- package/dist/cjs/number.cjs +13 -4
- package/dist/cjs/object.cjs +18 -4
- package/dist/cjs/path.cjs +7 -2
- package/dist/cjs/qs.cjs +7 -2
- package/dist/cjs/random.cjs +9 -2
- package/dist/cjs/string.cjs +15 -2
- package/dist/cjs/tooltip.cjs +6 -2
- package/dist/cjs/tree.cjs +13 -2
- package/dist/cjs/type.cjs +27 -2
- package/dist/cjs/unicodeToolkit.cjs +6 -2
- package/dist/cjs/unique.cjs +8 -2
- package/dist/cjs/url.cjs +9 -2
- package/dist/cjs/validator.cjs +21 -2
- package/dist/cjs/variable.cjs +10 -2
- package/dist/cjs/watermark.cjs +6 -2
- package/dist/esm/array.mjs +9 -2
- package/dist/esm/async.mjs +7 -2
- package/dist/esm/base64.mjs +8 -2
- package/dist/esm/clipboard.mjs +6 -2
- package/dist/esm/cloneDeep.mjs +5 -2
- package/dist/esm/cookie.mjs +7 -2
- package/dist/esm/date.mjs +20 -2
- package/dist/esm/dom.mjs +22 -2
- package/dist/esm/download.mjs +9 -2
- package/dist/esm/file.mjs +7 -2
- package/dist/esm/func.mjs +9 -2
- package/dist/esm/index.mjs +63 -2
- package/dist/esm/isEqual.mjs +5 -2
- package/dist/esm/math.mjs +9 -2
- package/dist/esm/number.mjs +20 -4
- package/dist/esm/object.mjs +16 -2
- package/dist/esm/path.mjs +6 -2
- package/dist/esm/qs.mjs +7 -3
- package/dist/esm/random.mjs +8 -2
- package/dist/esm/string.mjs +14 -1
- package/dist/esm/tooltip.mjs +5 -2
- package/dist/esm/tree.mjs +23 -3
- package/dist/esm/type.mjs +27 -2
- package/dist/esm/unicodeToolkit.mjs +5 -2
- package/dist/esm/unique.mjs +7 -2
- package/dist/esm/url.mjs +9 -3
- package/dist/esm/validator.mjs +20 -1
- package/dist/esm/variable.mjs +10 -3
- package/dist/esm/watermark.mjs +5 -2
- package/dist/types/array.d.ts +8 -0
- package/dist/types/async.d.ts +6 -0
- package/dist/types/base64.d.ts +7 -0
- package/dist/types/clipboard.d.ts +5 -1
- package/dist/types/cloneDeep.d.ts +4 -0
- package/dist/types/cookie.d.ts +6 -0
- package/dist/types/date.d.ts +10 -0
- package/dist/types/dom.d.ts +11 -0
- package/dist/types/download.d.ts +8 -1
- package/dist/types/file.d.ts +6 -1
- package/dist/types/func.d.ts +8 -0
- package/dist/types/isEqual.d.ts +4 -0
- package/dist/types/math.d.ts +8 -1
- package/dist/types/number.d.ts +11 -2
- package/dist/types/object.d.ts +13 -0
- package/dist/types/path.d.ts +5 -0
- package/dist/types/qs.d.ts +5 -0
- package/dist/types/random.d.ts +7 -0
- package/dist/types/string.d.ts +13 -0
- package/dist/types/tooltip.d.ts +7 -0
- package/dist/types/tree.d.ts +11 -0
- package/dist/types/type.d.ts +29 -4
- package/dist/types/unicodeToolkit.d.ts +4 -0
- package/dist/types/unique.d.ts +6 -0
- package/dist/types/url.d.ts +7 -0
- package/dist/types/validator.d.ts +19 -0
- package/dist/types/variable.d.ts +8 -0
- package/dist/types/watermark.d.ts +4 -0
- package/dist/umd/index.min.js +2 -2
- package/package.json +1 -1
- package/dist/types/index.d.ts +0 -28
package/README.md
CHANGED
|
@@ -120,17 +120,94 @@ const cloned = cloneDeep(original);
|
|
|
120
120
|
|
|
121
121
|
## 📦 Module Formats
|
|
122
122
|
|
|
123
|
+
### Named Imports (Recommended)
|
|
124
|
+
|
|
123
125
|
```js
|
|
124
|
-
// ES Modules (
|
|
125
|
-
import { cloneDeep } from 'sculp-js';
|
|
126
|
+
// ES Modules - Named imports (tree-shaking friendly)
|
|
127
|
+
import { cloneDeep, forEachDeep } from 'sculp-js';
|
|
128
|
+
|
|
129
|
+
// CommonJS - Named imports
|
|
130
|
+
const { cloneDeep, forEachDeep } = require('sculp-js');
|
|
131
|
+
```
|
|
126
132
|
|
|
127
|
-
|
|
128
|
-
import cloneDeep from 'sculp-js/cloneDeep';
|
|
133
|
+
### Default Import (Full Library)
|
|
129
134
|
|
|
130
|
-
|
|
131
|
-
|
|
135
|
+
```js
|
|
136
|
+
// ES Modules - Default import
|
|
137
|
+
import sculp from 'sculp-js';
|
|
138
|
+
const { cloneDeep, forEachDeep } = sculp;
|
|
139
|
+
|
|
140
|
+
// CommonJS - Default import
|
|
141
|
+
const sculp = require('sculp-js');
|
|
142
|
+
const { cloneDeep, forEachDeep } = sculp;
|
|
132
143
|
```
|
|
133
144
|
|
|
145
|
+
### Module-Specific Imports
|
|
146
|
+
|
|
147
|
+
Import specific modules for better tree-shaking and smaller bundle sizes:
|
|
148
|
+
|
|
149
|
+
```js
|
|
150
|
+
// ES Modules - Import specific modules
|
|
151
|
+
import array from 'sculp-js/array';
|
|
152
|
+
import string from 'sculp-js/string';
|
|
153
|
+
import type from 'sculp-js/type';
|
|
154
|
+
import date from 'sculp-js/date';
|
|
155
|
+
import object from 'sculp-js/object';
|
|
156
|
+
import math from 'sculp-js/math';
|
|
157
|
+
import validator from 'sculp-js/validator';
|
|
158
|
+
// ... and more
|
|
159
|
+
|
|
160
|
+
// CommonJS - Import specific modules
|
|
161
|
+
const array = require('sculp-js/array');
|
|
162
|
+
const string = require('sculp-js/string');
|
|
163
|
+
const type = require('sculp-js/type');
|
|
164
|
+
|
|
165
|
+
// Usage examples
|
|
166
|
+
import array from 'sculp-js/array';
|
|
167
|
+
array.arrayEach([1, 2, 3], val => console.log(val));
|
|
168
|
+
|
|
169
|
+
import string from 'sculp-js/string';
|
|
170
|
+
const camelCase = string.stringCamelCase('hello-world'); // 'helloWorld'
|
|
171
|
+
|
|
172
|
+
import validator from 'sculp-js/validator';
|
|
173
|
+
if (validator.isEmail('test@example.com')) {
|
|
174
|
+
console.log('Valid email');
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Available Modules
|
|
179
|
+
|
|
180
|
+
All modules support both named and default exports:
|
|
181
|
+
|
|
182
|
+
- `sculp-js/array` - Array utilities
|
|
183
|
+
- `sculp-js/string` - String manipulation
|
|
184
|
+
- `sculp-js/type` - Type checking
|
|
185
|
+
- `sculp-js/date` - Date formatting
|
|
186
|
+
- `sculp-js/object` - Object utilities
|
|
187
|
+
- `sculp-js/math` - Math operations
|
|
188
|
+
- `sculp-js/number` - Number formatting
|
|
189
|
+
- `sculp-js/url` - URL parsing
|
|
190
|
+
- `sculp-js/qs` - Query string parsing
|
|
191
|
+
- `sculp-js/path` - Path utilities
|
|
192
|
+
- `sculp-js/async` - Async utilities
|
|
193
|
+
- `sculp-js/func` - Function utilities
|
|
194
|
+
- `sculp-js/random` - Random generators
|
|
195
|
+
- `sculp-js/validator` - Validation functions
|
|
196
|
+
- `sculp-js/tree` - Tree operations
|
|
197
|
+
- `sculp-js/base64` - Base64 encoding
|
|
198
|
+
- `sculp-js/unique` - Unique ID generators
|
|
199
|
+
- `sculp-js/variable` - Variable utilities
|
|
200
|
+
- `sculp-js/clipboard` - Clipboard operations
|
|
201
|
+
- `sculp-js/cookie` - Cookie management
|
|
202
|
+
- `sculp-js/dom` - DOM utilities
|
|
203
|
+
- `sculp-js/download` - Download helpers
|
|
204
|
+
- `sculp-js/file` - File utilities
|
|
205
|
+
- `sculp-js/watermark` - Watermark generation
|
|
206
|
+
- `sculp-js/tooltip` - Tooltip utilities
|
|
207
|
+
- `sculp-js/cloneDeep` - Deep cloning
|
|
208
|
+
- `sculp-js/isEqual` - Deep equality
|
|
209
|
+
- `sculp-js/unicodeToolkit` - Unicode utilities
|
|
210
|
+
|
|
134
211
|
## 📄 License
|
|
135
212
|
|
|
136
213
|
MIT License © 2023-present, [chandq](https://github.com/chandq)
|
package/dist/cjs/array.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
2
|
+
* sculp-js v1.19.0
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
Object.
|
|
9
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* 遍历数组,返回 false 中断遍历(支持continue和break操作)
|
|
@@ -166,9 +166,17 @@ function diffArray(source, target, getKey) {
|
|
|
166
166
|
}
|
|
167
167
|
return { added, removed: del };
|
|
168
168
|
}
|
|
169
|
+
var array = {
|
|
170
|
+
arrayEach,
|
|
171
|
+
arrayEachAsync,
|
|
172
|
+
arrayInsertBefore,
|
|
173
|
+
arrayRemove,
|
|
174
|
+
diffArray
|
|
175
|
+
};
|
|
169
176
|
|
|
170
177
|
exports.arrayEach = arrayEach;
|
|
171
178
|
exports.arrayEachAsync = arrayEachAsync;
|
|
172
179
|
exports.arrayInsertBefore = arrayInsertBefore;
|
|
173
180
|
exports.arrayRemove = arrayRemove;
|
|
181
|
+
exports.default = array;
|
|
174
182
|
exports.diffArray = diffArray;
|
package/dist/cjs/async.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
2
|
+
* sculp-js v1.19.0
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
Object.
|
|
9
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* 等待一段时间
|
|
@@ -88,7 +88,13 @@ function safeAwait(promise, errorExt) {
|
|
|
88
88
|
return [err, undefined];
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
+
var async = {
|
|
92
|
+
wait,
|
|
93
|
+
asyncMap,
|
|
94
|
+
safeAwait
|
|
95
|
+
};
|
|
91
96
|
|
|
92
97
|
exports.asyncMap = asyncMap;
|
|
98
|
+
exports.default = async;
|
|
93
99
|
exports.safeAwait = safeAwait;
|
|
94
100
|
exports.wait = wait;
|
package/dist/cjs/base64.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
2
|
+
* sculp-js v1.19.0
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
Object.
|
|
9
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
10
|
|
|
11
11
|
var func = require('./func.cjs');
|
|
12
12
|
var type = require('./type.cjs');
|
|
@@ -122,8 +122,15 @@ function b64encode(rawStr) {
|
|
|
122
122
|
// 将二进制字符串转换为base64编码的字符串
|
|
123
123
|
return !type.isNullOrUnDef(func.getGlobal('btoa')) ? func.getGlobal('btoa')(binaryString) : weBtoa(binaryString);
|
|
124
124
|
}
|
|
125
|
+
var base64 = {
|
|
126
|
+
weBtoa,
|
|
127
|
+
weAtob,
|
|
128
|
+
b64decode,
|
|
129
|
+
b64encode
|
|
130
|
+
};
|
|
125
131
|
|
|
126
132
|
exports.b64decode = b64decode;
|
|
127
133
|
exports.b64encode = b64encode;
|
|
134
|
+
exports.default = base64;
|
|
128
135
|
exports.weAtob = weAtob;
|
|
129
136
|
exports.weBtoa = weBtoa;
|
package/dist/cjs/clipboard.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
2
|
+
* sculp-js v1.19.0
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
Object.
|
|
9
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
10
|
|
|
11
11
|
var dom = require('./dom.cjs');
|
|
12
12
|
var type = require('./type.cjs');
|
|
@@ -90,6 +90,11 @@ function createFakeElement(value) {
|
|
|
90
90
|
fakeElement.value = value;
|
|
91
91
|
return fakeElement;
|
|
92
92
|
}
|
|
93
|
+
var clipboard = {
|
|
94
|
+
copyText,
|
|
95
|
+
fallbackCopyText
|
|
96
|
+
};
|
|
93
97
|
|
|
94
98
|
exports.copyText = copyText;
|
|
99
|
+
exports.default = clipboard;
|
|
95
100
|
exports.fallbackCopyText = fallbackCopyText;
|
package/dist/cjs/cloneDeep.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
2
|
+
* sculp-js v1.19.0
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
Object.
|
|
9
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* 深拷贝堪称完全体 即:任何类型的数据都会被深拷贝
|
|
@@ -114,5 +114,9 @@ function cloneDeep(source, map = new WeakMap()) {
|
|
|
114
114
|
}
|
|
115
115
|
return copy;
|
|
116
116
|
}
|
|
117
|
+
var cloneDeep_default = {
|
|
118
|
+
cloneDeep
|
|
119
|
+
};
|
|
117
120
|
|
|
118
121
|
exports.cloneDeep = cloneDeep;
|
|
122
|
+
exports.default = cloneDeep_default;
|
package/dist/cjs/cookie.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
2
|
+
* sculp-js v1.19.0
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
Object.
|
|
9
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
10
|
|
|
11
11
|
var type = require('./type.cjs');
|
|
12
12
|
|
|
@@ -56,7 +56,13 @@ function cookieSet(name, value, maxAge) {
|
|
|
56
56
|
* @param name cookie 名称
|
|
57
57
|
*/
|
|
58
58
|
const cookieDel = name => cookieSet(name, '', -1);
|
|
59
|
+
var cookie = {
|
|
60
|
+
cookieSet,
|
|
61
|
+
cookieGet,
|
|
62
|
+
cookieDel
|
|
63
|
+
};
|
|
59
64
|
|
|
60
65
|
exports.cookieDel = cookieDel;
|
|
61
66
|
exports.cookieGet = cookieGet;
|
|
62
67
|
exports.cookieSet = cookieSet;
|
|
68
|
+
exports.default = cookie;
|
package/dist/cjs/date.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
2
|
+
* sculp-js v1.19.0
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
Object.
|
|
9
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
10
|
|
|
11
11
|
var type = require('./type.cjs');
|
|
12
12
|
|
|
@@ -212,11 +212,21 @@ function calculateDateTime(originDateTime, n, dateSep = '-', timeSep = ':') {
|
|
|
212
212
|
String(targetDateTime.getSeconds()).padStart(2, '0')
|
|
213
213
|
);
|
|
214
214
|
}
|
|
215
|
+
var date = {
|
|
216
|
+
isValidDate,
|
|
217
|
+
dateParse,
|
|
218
|
+
dateToStart,
|
|
219
|
+
dateToEnd,
|
|
220
|
+
formatDate,
|
|
221
|
+
calculateDate,
|
|
222
|
+
calculateDateTime
|
|
223
|
+
};
|
|
215
224
|
|
|
216
225
|
exports.calculateDate = calculateDate;
|
|
217
226
|
exports.calculateDateTime = calculateDateTime;
|
|
218
227
|
exports.dateParse = dateParse;
|
|
219
228
|
exports.dateToEnd = dateToEnd;
|
|
220
229
|
exports.dateToStart = dateToStart;
|
|
230
|
+
exports.default = date;
|
|
221
231
|
exports.formatDate = formatDate;
|
|
222
232
|
exports.isValidDate = isValidDate;
|
package/dist/cjs/dom.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
2
|
+
* sculp-js v1.19.0
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
Object.
|
|
9
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
10
|
|
|
11
11
|
var object = require('./object.cjs');
|
|
12
12
|
var string = require('./string.cjs');
|
|
@@ -150,8 +150,19 @@ function select(element) {
|
|
|
150
150
|
}
|
|
151
151
|
return selectedText;
|
|
152
152
|
}
|
|
153
|
+
var dom = {
|
|
154
|
+
hasClass,
|
|
155
|
+
addClass,
|
|
156
|
+
removeClass,
|
|
157
|
+
setStyle,
|
|
158
|
+
getStyle,
|
|
159
|
+
getComputedCssVal,
|
|
160
|
+
getStrWidthPx,
|
|
161
|
+
select
|
|
162
|
+
};
|
|
153
163
|
|
|
154
164
|
exports.addClass = addClass;
|
|
165
|
+
exports.default = dom;
|
|
155
166
|
exports.getComputedCssVal = getComputedCssVal;
|
|
156
167
|
exports.getStrWidthPx = getStrWidthPx;
|
|
157
168
|
exports.getStyle = getStyle;
|
package/dist/cjs/download.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
2
|
+
* sculp-js v1.19.0
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
Object.
|
|
9
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
10
|
|
|
11
11
|
var type = require('./type.cjs');
|
|
12
12
|
var url = require('./url.cjs');
|
|
@@ -131,8 +131,16 @@ function downloadData(data, fileType, filename, headers) {
|
|
|
131
131
|
downloadHref(href, filename);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
+
var download = {
|
|
135
|
+
downloadURL,
|
|
136
|
+
downloadHref,
|
|
137
|
+
downloadBlob,
|
|
138
|
+
crossOriginDownload,
|
|
139
|
+
downloadData
|
|
140
|
+
};
|
|
134
141
|
|
|
135
142
|
exports.crossOriginDownload = crossOriginDownload;
|
|
143
|
+
exports.default = download;
|
|
136
144
|
exports.downloadBlob = downloadBlob;
|
|
137
145
|
exports.downloadData = downloadData;
|
|
138
146
|
exports.downloadHref = downloadHref;
|
package/dist/cjs/file.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
2
|
+
* sculp-js v1.19.0
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
Object.
|
|
9
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
10
|
|
|
11
11
|
var type = require('./type.cjs');
|
|
12
12
|
|
|
@@ -208,7 +208,13 @@ function compressImg(file, options = { mime: 'image/jpeg', minFileSizeKB: 50 })
|
|
|
208
208
|
}
|
|
209
209
|
return Promise.resolve(null);
|
|
210
210
|
}
|
|
211
|
+
var file = {
|
|
212
|
+
supportCanvas,
|
|
213
|
+
chooseLocalFile,
|
|
214
|
+
compressImg
|
|
215
|
+
};
|
|
211
216
|
|
|
212
217
|
exports.chooseLocalFile = chooseLocalFile;
|
|
213
218
|
exports.compressImg = compressImg;
|
|
219
|
+
exports.default = file;
|
|
214
220
|
exports.supportCanvas = supportCanvas;
|
package/dist/cjs/func.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
2
|
+
* sculp-js v1.19.0
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
Object.
|
|
9
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* 防抖函数
|
|
@@ -113,8 +113,16 @@ function getGlobal(key) {
|
|
|
113
113
|
else if (typeof global !== 'undefined') return global[key];
|
|
114
114
|
else if (typeof self !== 'undefined') return self[key];
|
|
115
115
|
}
|
|
116
|
+
var func = {
|
|
117
|
+
debounce,
|
|
118
|
+
throttle,
|
|
119
|
+
once,
|
|
120
|
+
getGlobal,
|
|
121
|
+
setGlobal
|
|
122
|
+
};
|
|
116
123
|
|
|
117
124
|
exports.debounce = debounce;
|
|
125
|
+
exports.default = func;
|
|
118
126
|
exports.getGlobal = getGlobal;
|
|
119
127
|
exports.once = once;
|
|
120
128
|
exports.setGlobal = setGlobal;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
2
|
+
* sculp-js v1.19.0
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
Object.
|
|
9
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
10
|
|
|
11
11
|
var array = require('./array.cjs');
|
|
12
12
|
var clipboard = require('./clipboard.cjs');
|
|
@@ -37,6 +37,37 @@ var cloneDeep = require('./cloneDeep.cjs');
|
|
|
37
37
|
var isEqual = require('./isEqual.cjs');
|
|
38
38
|
var unicodeToolkit = require('./unicodeToolkit.cjs');
|
|
39
39
|
|
|
40
|
+
var index = {
|
|
41
|
+
...array,
|
|
42
|
+
...clipboard,
|
|
43
|
+
...cookie,
|
|
44
|
+
...date,
|
|
45
|
+
...dom,
|
|
46
|
+
...download,
|
|
47
|
+
...object,
|
|
48
|
+
...path,
|
|
49
|
+
...qs,
|
|
50
|
+
...string,
|
|
51
|
+
...type,
|
|
52
|
+
...url,
|
|
53
|
+
...async,
|
|
54
|
+
...file,
|
|
55
|
+
...watermark,
|
|
56
|
+
...func,
|
|
57
|
+
...random,
|
|
58
|
+
...number,
|
|
59
|
+
...unique,
|
|
60
|
+
...tooltip,
|
|
61
|
+
...tree,
|
|
62
|
+
...math,
|
|
63
|
+
...base64,
|
|
64
|
+
...validator,
|
|
65
|
+
...variable,
|
|
66
|
+
...cloneDeep,
|
|
67
|
+
...isEqual,
|
|
68
|
+
...unicodeToolkit
|
|
69
|
+
};
|
|
70
|
+
|
|
40
71
|
exports.arrayEach = array.arrayEach;
|
|
41
72
|
exports.arrayEachAsync = array.arrayEachAsync;
|
|
42
73
|
exports.arrayInsertBefore = array.arrayInsertBefore;
|
|
@@ -113,7 +144,7 @@ exports.isString = type.isString;
|
|
|
113
144
|
exports.isSymbol = type.isSymbol;
|
|
114
145
|
exports.isUndefined = type.isUndefined;
|
|
115
146
|
exports.objectHas = type.objectHas;
|
|
116
|
-
exports.typeIs = type.
|
|
147
|
+
exports.typeIs = type.typeIs;
|
|
117
148
|
exports.urlDelParams = url.urlDelParams;
|
|
118
149
|
exports.urlParse = url.urlParse;
|
|
119
150
|
exports.urlSetParams = url.urlSetParams;
|
|
@@ -185,3 +216,4 @@ exports.uniqueSymbol = variable.uniqueSymbol;
|
|
|
185
216
|
exports.cloneDeep = cloneDeep.cloneDeep;
|
|
186
217
|
exports.isEqual = isEqual.isEqual;
|
|
187
218
|
exports.UnicodeToolkit = unicodeToolkit.UnicodeToolkit;
|
|
219
|
+
exports.default = index;
|
package/dist/cjs/isEqual.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
2
|
+
* sculp-js v1.19.0
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
Object.
|
|
9
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* 使用位运算或常量定义常用 Tag,这里保持字符串以匹配 Object.prototype.toString
|
|
@@ -208,5 +208,9 @@ function deepCompareObject(a, b, stack) {
|
|
|
208
208
|
}
|
|
209
209
|
return true;
|
|
210
210
|
}
|
|
211
|
+
var isEqual_default = {
|
|
212
|
+
isEqual
|
|
213
|
+
};
|
|
211
214
|
|
|
215
|
+
exports.default = isEqual_default;
|
|
212
216
|
exports.isEqual = isEqual;
|
package/dist/cjs/math.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
2
|
+
* sculp-js v1.19.0
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
Object.
|
|
9
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* 数值安全乘法
|
|
@@ -76,8 +76,16 @@ const divide = (arg1, arg2) => {
|
|
|
76
76
|
function strip(num, precision = 15) {
|
|
77
77
|
return +parseFloat(Number(num).toPrecision(precision));
|
|
78
78
|
}
|
|
79
|
+
var math = {
|
|
80
|
+
add,
|
|
81
|
+
subtract,
|
|
82
|
+
multiply,
|
|
83
|
+
divide,
|
|
84
|
+
strip
|
|
85
|
+
};
|
|
79
86
|
|
|
80
87
|
exports.add = add;
|
|
88
|
+
exports.default = math;
|
|
81
89
|
exports.divide = divide;
|
|
82
90
|
exports.multiply = multiply;
|
|
83
91
|
exports.strip = strip;
|
package/dist/cjs/number.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
2
|
+
* sculp-js v1.19.0
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
Object.
|
|
9
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
10
|
|
|
11
11
|
var func = require('./func.cjs');
|
|
12
12
|
var string = require('./string.cjs');
|
|
@@ -72,9 +72,9 @@ const numberAbbr = (num, units, options = { ratio: 1000, decimals: 0, separator:
|
|
|
72
72
|
* reference: https://zh.wikipedia.org/wiki/%E5%8D%83%E5%AD%97%E8%8A%82
|
|
73
73
|
* @param {number | string} num bytes Number in Bytes
|
|
74
74
|
* @param {IHumanFileSizeOptions} options default: { decimals = 0, si = false, separator = ' ' }
|
|
75
|
-
* si: True to use metric (SI) units, aka powers of 1000,
|
|
75
|
+
* si: True to use metric (SI) units, aka powers of 1000, units is
|
|
76
76
|
* ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'].
|
|
77
|
-
* False to use binary (IEC), aka powers of 1024,
|
|
77
|
+
* False to use binary (IEC), aka powers of 1024, units is
|
|
78
78
|
* ['Byte', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']
|
|
79
79
|
* @returns
|
|
80
80
|
*/
|
|
@@ -113,8 +113,17 @@ function formatNumber(num, decimals) {
|
|
|
113
113
|
}
|
|
114
114
|
return Number(Number(num).toFixed(prec)).toLocaleString('en-US');
|
|
115
115
|
}
|
|
116
|
+
var number = {
|
|
117
|
+
HEX_POOL,
|
|
118
|
+
numberToHex,
|
|
119
|
+
numberAbbr,
|
|
120
|
+
humanFileSize,
|
|
121
|
+
formatNumber,
|
|
122
|
+
formatMoney: formatNumber
|
|
123
|
+
};
|
|
116
124
|
|
|
117
125
|
exports.HEX_POOL = HEX_POOL;
|
|
126
|
+
exports.default = number;
|
|
118
127
|
exports.formatMoney = formatNumber;
|
|
119
128
|
exports.formatNumber = formatNumber;
|
|
120
129
|
exports.humanFileSize = humanFileSize;
|
package/dist/cjs/object.cjs
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
2
|
+
* sculp-js v1.19.0
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
Object.
|
|
9
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
10
|
|
|
11
11
|
var type = require('./type.cjs');
|
|
12
12
|
|
|
13
|
+
const typeIs = type.typeIs;
|
|
13
14
|
/**
|
|
14
15
|
* 判断对象是否为纯对象
|
|
15
16
|
* @param {object} obj
|
|
@@ -101,8 +102,8 @@ function objectOmit(obj, keys) {
|
|
|
101
102
|
}
|
|
102
103
|
const merge = (map, source, target) => {
|
|
103
104
|
if (type.isUndefined(target)) return source;
|
|
104
|
-
const sourceType =
|
|
105
|
-
const targetType =
|
|
105
|
+
const sourceType = typeIs(source);
|
|
106
|
+
const targetType = typeIs(target);
|
|
106
107
|
if (sourceType !== targetType) {
|
|
107
108
|
if (type.isArray(target)) return merge(map, [], target);
|
|
108
109
|
if (type.isObject(target)) return merge(map, {}, target);
|
|
@@ -195,7 +196,20 @@ function objectGet(obj, path, strict = false) {
|
|
|
195
196
|
v: tempObj ? tempObj[keyArr[i]] : undefined
|
|
196
197
|
};
|
|
197
198
|
}
|
|
199
|
+
var object = {
|
|
200
|
+
isPlainObject,
|
|
201
|
+
objectEach,
|
|
202
|
+
objectEachAsync,
|
|
203
|
+
objectMap,
|
|
204
|
+
objectPick,
|
|
205
|
+
objectOmit,
|
|
206
|
+
objectAssign,
|
|
207
|
+
objectMerge: objectAssign,
|
|
208
|
+
objectFill,
|
|
209
|
+
objectGet
|
|
210
|
+
};
|
|
198
211
|
|
|
212
|
+
exports.default = object;
|
|
199
213
|
exports.isPlainObject = isPlainObject;
|
|
200
214
|
exports.objectAssign = objectAssign;
|
|
201
215
|
exports.objectEach = objectEach;
|
package/dist/cjs/path.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.
|
|
2
|
+
* sculp-js v1.19.0
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
Object.
|
|
9
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* 标准化路径
|
|
@@ -59,6 +59,11 @@ const pathNormalize = path => {
|
|
|
59
59
|
* @returns {string}
|
|
60
60
|
*/
|
|
61
61
|
const pathJoin = (from, ...to) => pathNormalize([from, ...to].join('/'));
|
|
62
|
+
var path = {
|
|
63
|
+
pathJoin,
|
|
64
|
+
pathNormalize
|
|
65
|
+
};
|
|
62
66
|
|
|
67
|
+
exports.default = path;
|
|
63
68
|
exports.pathJoin = pathJoin;
|
|
64
69
|
exports.pathNormalize = pathNormalize;
|