sculp-js 1.10.3 → 1.10.5
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/lib/cjs/array.js +7 -9
- package/lib/cjs/async.js +1 -1
- package/lib/cjs/base64.js +1 -1
- package/lib/cjs/clipboard.js +1 -1
- package/lib/cjs/cloneDeep.js +1 -1
- package/lib/cjs/cookie.js +1 -1
- package/lib/cjs/date.js +1 -1
- package/lib/cjs/dom.js +1 -1
- package/lib/cjs/download.js +1 -1
- package/lib/cjs/easing.js +1 -1
- package/lib/cjs/file.js +10 -9
- package/lib/cjs/func.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/isEqual.js +1 -1
- package/lib/cjs/math.js +1 -1
- package/lib/cjs/number.js +1 -1
- package/lib/cjs/object.js +10 -2
- package/lib/cjs/path.js +1 -1
- package/lib/cjs/qs.js +1 -1
- package/lib/cjs/random.js +1 -1
- package/lib/cjs/string.js +1 -1
- package/lib/cjs/tooltip.js +1 -1
- package/lib/cjs/tree.js +7 -1
- package/lib/cjs/type.js +4 -3
- package/lib/cjs/unique.js +1 -1
- package/lib/cjs/url.js +1 -1
- package/lib/cjs/validator.js +1 -1
- package/lib/cjs/variable.js +1 -1
- package/lib/cjs/watermark.js +1 -1
- package/lib/cjs/we-decode.js +1 -1
- package/lib/es/array.js +7 -9
- package/lib/es/async.js +1 -1
- package/lib/es/base64.js +1 -1
- package/lib/es/clipboard.js +1 -1
- package/lib/es/cloneDeep.js +1 -1
- package/lib/es/cookie.js +1 -1
- package/lib/es/date.js +1 -1
- package/lib/es/dom.js +1 -1
- package/lib/es/download.js +1 -1
- package/lib/es/easing.js +1 -1
- package/lib/es/file.js +10 -9
- package/lib/es/func.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/es/isEqual.js +1 -1
- package/lib/es/math.js +1 -1
- package/lib/es/number.js +1 -1
- package/lib/es/object.js +10 -2
- package/lib/es/path.js +1 -1
- package/lib/es/qs.js +1 -1
- package/lib/es/random.js +1 -1
- package/lib/es/string.js +1 -1
- package/lib/es/tooltip.js +1 -1
- package/lib/es/tree.js +7 -1
- package/lib/es/type.js +4 -3
- package/lib/es/unique.js +1 -1
- package/lib/es/url.js +1 -1
- package/lib/es/validator.js +1 -1
- package/lib/es/variable.js +1 -1
- package/lib/es/watermark.js +1 -1
- package/lib/es/we-decode.js +1 -1
- package/lib/index.d.ts +17 -7
- package/lib/umd/index.js +2 -3218
- package/package.json +2 -1
package/lib/cjs/array.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.10.
|
|
2
|
+
* sculp-js v1.10.5
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
function arrayEach(array, iterator, reverse = false) {
|
|
18
18
|
if (reverse) {
|
|
19
19
|
for (let idx = array.length - 1; idx >= 0; idx--) {
|
|
20
|
-
const
|
|
21
|
-
const re = iterator(val, idx, array);
|
|
20
|
+
const re = iterator(array[idx], idx, array);
|
|
22
21
|
if (re === false)
|
|
23
22
|
break;
|
|
24
23
|
else if (re === true)
|
|
@@ -27,14 +26,15 @@ function arrayEach(array, iterator, reverse = false) {
|
|
|
27
26
|
}
|
|
28
27
|
else {
|
|
29
28
|
for (let idx = 0, len = array.length; idx < len; idx++) {
|
|
30
|
-
const
|
|
31
|
-
const re = iterator(val, idx, array);
|
|
29
|
+
const re = iterator(array[idx], idx, array);
|
|
32
30
|
if (re === false)
|
|
33
31
|
break;
|
|
34
32
|
else if (re === true)
|
|
35
33
|
continue;
|
|
36
34
|
}
|
|
37
35
|
}
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
array = null;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* 异步遍历数组,返回 false 中断遍历
|
|
@@ -62,15 +62,13 @@ function arrayEach(array, iterator, reverse = false) {
|
|
|
62
62
|
async function arrayEachAsync(array, iterator, reverse = false) {
|
|
63
63
|
if (reverse) {
|
|
64
64
|
for (let idx = array.length - 1; idx >= 0; idx--) {
|
|
65
|
-
|
|
66
|
-
if ((await iterator(val, idx)) === false)
|
|
65
|
+
if ((await iterator(array[idx], idx)) === false)
|
|
67
66
|
break;
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
else {
|
|
71
70
|
for (let idx = 0, len = array.length; idx < len; idx++) {
|
|
72
|
-
|
|
73
|
-
if ((await iterator(val, idx)) === false)
|
|
71
|
+
if ((await iterator(array[idx], idx)) === false)
|
|
74
72
|
break;
|
|
75
73
|
}
|
|
76
74
|
}
|
package/lib/cjs/async.js
CHANGED
package/lib/cjs/base64.js
CHANGED
package/lib/cjs/clipboard.js
CHANGED
package/lib/cjs/cloneDeep.js
CHANGED
package/lib/cjs/cookie.js
CHANGED
package/lib/cjs/date.js
CHANGED
package/lib/cjs/dom.js
CHANGED
package/lib/cjs/download.js
CHANGED
package/lib/cjs/easing.js
CHANGED
package/lib/cjs/file.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.10.
|
|
2
|
+
* sculp-js v1.10.5
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -108,31 +108,31 @@ function scalingByAspectRatio({ sizeKB, maxSize, originWidth, originHeight }) {
|
|
|
108
108
|
return { width: targetWidth, height: targetHeight };
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
|
-
* Web端:等比例压缩图片批量处理 (
|
|
111
|
+
* Web端:等比例压缩图片批量处理 (小于minFileSizeKB:50,不压缩), 支持压缩全景图或长截图
|
|
112
112
|
*
|
|
113
113
|
* 1. 默认根据图片原始size及宽高适当地调整quality、width、height
|
|
114
114
|
* 2. 可指定压缩的图片质量 quality(若不指定则根据原始图片大小来计算), 来适当调整width、height
|
|
115
115
|
* 3. 可指定压缩的图片最大宽高 maxSize(若不指定则根据原始图片宽高来计算), 满足大屏幕图片展示的场景
|
|
116
116
|
*
|
|
117
117
|
* @param {File | FileList} file 图片或图片数组
|
|
118
|
-
* @param {ICompressOptions} options 压缩图片配置项,default: {mime:'image/jpeg'}
|
|
119
|
-
* @returns {Promise<
|
|
118
|
+
* @param {ICompressOptions} options 压缩图片配置项,default: {mime:'image/jpeg', minFileSizeKB: 50}
|
|
119
|
+
* @returns {Promise<ICompressImgResult | ICompressImgResult[] | null>}
|
|
120
120
|
*/
|
|
121
|
-
function compressImg(file, options = { mime: 'image/jpeg' }) {
|
|
121
|
+
function compressImg(file, options = { mime: 'image/jpeg', minFileSizeKB: 50 }) {
|
|
122
122
|
if (!(file instanceof File || file instanceof FileList)) {
|
|
123
123
|
throw new Error(`${file} require be File or FileList`);
|
|
124
124
|
}
|
|
125
125
|
else if (!supportCanvas()) {
|
|
126
126
|
throw new Error(`Current runtime environment not support Canvas`);
|
|
127
127
|
}
|
|
128
|
-
const { quality, mime = 'image/jpeg', maxSize: size } = type.isObject(options) ? options : {};
|
|
128
|
+
const { quality, mime = 'image/jpeg', maxSize: size, minFileSizeKB = 50 } = type.isObject(options) ? options : {};
|
|
129
129
|
let targetQuality = quality, maxSize;
|
|
130
130
|
if (quality) {
|
|
131
131
|
targetQuality = quality;
|
|
132
132
|
}
|
|
133
133
|
else if (file instanceof File) {
|
|
134
134
|
const sizeKB = +parseInt((file.size / 1024).toFixed(2));
|
|
135
|
-
if (sizeKB <
|
|
135
|
+
if (sizeKB < minFileSizeKB) {
|
|
136
136
|
targetQuality = 1;
|
|
137
137
|
}
|
|
138
138
|
else if (sizeKB < 1 * 1024) {
|
|
@@ -160,7 +160,7 @@ function compressImg(file, options = { mime: 'image/jpeg' }) {
|
|
|
160
160
|
};
|
|
161
161
|
const fileName = [...file.name.split('.').slice(0, -1), ext[mime]].join('.');
|
|
162
162
|
const sizeKB = +parseInt((file.size / 1024).toFixed(2));
|
|
163
|
-
if (sizeKB <
|
|
163
|
+
if (sizeKB < minFileSizeKB) {
|
|
164
164
|
resolve({
|
|
165
165
|
file: file
|
|
166
166
|
});
|
|
@@ -196,7 +196,7 @@ function compressImg(file, options = { mime: 'image/jpeg' }) {
|
|
|
196
196
|
origin: file,
|
|
197
197
|
beforeSrc: src,
|
|
198
198
|
afterSrc: canvasURL,
|
|
199
|
-
beforeKB:
|
|
199
|
+
beforeKB: sizeKB,
|
|
200
200
|
afterKB: Number((miniFile.size / 1024).toFixed(2))
|
|
201
201
|
});
|
|
202
202
|
};
|
|
@@ -206,6 +206,7 @@ function compressImg(file, options = { mime: 'image/jpeg' }) {
|
|
|
206
206
|
}
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
|
+
return Promise.resolve(null);
|
|
209
210
|
}
|
|
210
211
|
|
|
211
212
|
exports.chooseLocalFile = chooseLocalFile;
|
package/lib/cjs/func.js
CHANGED
package/lib/cjs/index.js
CHANGED
package/lib/cjs/isEqual.js
CHANGED
package/lib/cjs/math.js
CHANGED
package/lib/cjs/number.js
CHANGED
package/lib/cjs/object.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.10.
|
|
2
|
+
* sculp-js v1.10.5
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -35,6 +35,8 @@ function objectEach(obj, iterator) {
|
|
|
35
35
|
if (iterator(obj[key], key) === false)
|
|
36
36
|
break;
|
|
37
37
|
}
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
obj = null;
|
|
38
40
|
}
|
|
39
41
|
/**
|
|
40
42
|
* 异步遍历对象,返回 false 中断遍历
|
|
@@ -62,6 +64,8 @@ function objectMap(obj, iterator) {
|
|
|
62
64
|
continue;
|
|
63
65
|
obj2[key] = iterator(obj[key], key);
|
|
64
66
|
}
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
obj = null;
|
|
65
69
|
return obj2;
|
|
66
70
|
}
|
|
67
71
|
/**
|
|
@@ -78,6 +82,8 @@ function objectPick(obj, keys) {
|
|
|
78
82
|
obj2[k] = v;
|
|
79
83
|
}
|
|
80
84
|
});
|
|
85
|
+
// @ts-ignore
|
|
86
|
+
obj = null;
|
|
81
87
|
return obj2;
|
|
82
88
|
}
|
|
83
89
|
/**
|
|
@@ -94,6 +100,8 @@ function objectOmit(obj, keys) {
|
|
|
94
100
|
obj2[k] = v;
|
|
95
101
|
}
|
|
96
102
|
});
|
|
103
|
+
// @ts-ignore
|
|
104
|
+
obj = null;
|
|
97
105
|
return obj2;
|
|
98
106
|
}
|
|
99
107
|
const merge = (map, source, target) => {
|
|
@@ -165,7 +173,7 @@ function objectFill(source, target, fillable) {
|
|
|
165
173
|
return source;
|
|
166
174
|
}
|
|
167
175
|
/**
|
|
168
|
-
*
|
|
176
|
+
* 获取对象/数组指定层级下的属性值(现在可用ES6+的可选链?.来替代)
|
|
169
177
|
* @param {AnyObject} obj
|
|
170
178
|
* @param {string} path
|
|
171
179
|
* @param {boolean} strict
|
package/lib/cjs/path.js
CHANGED
package/lib/cjs/qs.js
CHANGED
package/lib/cjs/random.js
CHANGED
package/lib/cjs/string.js
CHANGED
package/lib/cjs/tooltip.js
CHANGED
package/lib/cjs/tree.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.10.
|
|
2
|
+
* sculp-js v1.10.5
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -70,6 +70,8 @@ function forEachDeep(tree, iterator, children = 'children', isReverse = false) {
|
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
walk(tree, null);
|
|
73
|
+
// @ts-ignore
|
|
74
|
+
tree = null;
|
|
73
75
|
}
|
|
74
76
|
/**
|
|
75
77
|
* 创建一个新数组, 深度优先遍历的Map函数(支持continue和break操作), 可用于insert tree item 和 remove tree item
|
|
@@ -139,6 +141,8 @@ function mapDeep(tree, iterator, children = 'children', isReverse = false) {
|
|
|
139
141
|
}
|
|
140
142
|
};
|
|
141
143
|
walk(tree, null, newTree);
|
|
144
|
+
// @ts-ignore
|
|
145
|
+
tree = null;
|
|
142
146
|
return newTree;
|
|
143
147
|
}
|
|
144
148
|
/**
|
|
@@ -196,6 +200,8 @@ function formatTree(list, options = defaultFieldOptions) {
|
|
|
196
200
|
treeArr.push(item);
|
|
197
201
|
}
|
|
198
202
|
});
|
|
203
|
+
// @ts-ignore
|
|
204
|
+
list = null;
|
|
199
205
|
return treeArr;
|
|
200
206
|
}
|
|
201
207
|
/**
|
package/lib/cjs/type.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.10.
|
|
2
|
+
* sculp-js v1.10.5
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
10
10
|
|
|
11
11
|
// 常用类型定义
|
|
12
|
+
const { toString, hasOwnProperty } = Object.prototype;
|
|
12
13
|
/**
|
|
13
14
|
* 判断对象内是否有该静态属性
|
|
14
15
|
* @param {object} obj
|
|
@@ -16,7 +17,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
16
17
|
* @returns {boolean}
|
|
17
18
|
*/
|
|
18
19
|
function objectHas(obj, key) {
|
|
19
|
-
return
|
|
20
|
+
return hasOwnProperty.call(obj, key);
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
23
|
* 判断一个对象是否为类数组
|
|
@@ -43,7 +44,7 @@ function arrayLike(any) {
|
|
|
43
44
|
* @returns
|
|
44
45
|
*/
|
|
45
46
|
function typeIs(any) {
|
|
46
|
-
return
|
|
47
|
+
return toString.call(any).slice(8, -1);
|
|
47
48
|
}
|
|
48
49
|
// 基本数据类型判断
|
|
49
50
|
const isString = (any) => typeof any === 'string';
|
package/lib/cjs/unique.js
CHANGED
package/lib/cjs/url.js
CHANGED
package/lib/cjs/validator.js
CHANGED
package/lib/cjs/variable.js
CHANGED
package/lib/cjs/watermark.js
CHANGED
package/lib/cjs/we-decode.js
CHANGED
package/lib/es/array.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.10.
|
|
2
|
+
* sculp-js v1.10.5
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
function arrayEach(array, iterator, reverse = false) {
|
|
16
16
|
if (reverse) {
|
|
17
17
|
for (let idx = array.length - 1; idx >= 0; idx--) {
|
|
18
|
-
const
|
|
19
|
-
const re = iterator(val, idx, array);
|
|
18
|
+
const re = iterator(array[idx], idx, array);
|
|
20
19
|
if (re === false)
|
|
21
20
|
break;
|
|
22
21
|
else if (re === true)
|
|
@@ -25,14 +24,15 @@ function arrayEach(array, iterator, reverse = false) {
|
|
|
25
24
|
}
|
|
26
25
|
else {
|
|
27
26
|
for (let idx = 0, len = array.length; idx < len; idx++) {
|
|
28
|
-
const
|
|
29
|
-
const re = iterator(val, idx, array);
|
|
27
|
+
const re = iterator(array[idx], idx, array);
|
|
30
28
|
if (re === false)
|
|
31
29
|
break;
|
|
32
30
|
else if (re === true)
|
|
33
31
|
continue;
|
|
34
32
|
}
|
|
35
33
|
}
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
array = null;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* 异步遍历数组,返回 false 中断遍历
|
|
@@ -60,15 +60,13 @@ function arrayEach(array, iterator, reverse = false) {
|
|
|
60
60
|
async function arrayEachAsync(array, iterator, reverse = false) {
|
|
61
61
|
if (reverse) {
|
|
62
62
|
for (let idx = array.length - 1; idx >= 0; idx--) {
|
|
63
|
-
|
|
64
|
-
if ((await iterator(val, idx)) === false)
|
|
63
|
+
if ((await iterator(array[idx], idx)) === false)
|
|
65
64
|
break;
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
else {
|
|
69
68
|
for (let idx = 0, len = array.length; idx < len; idx++) {
|
|
70
|
-
|
|
71
|
-
if ((await iterator(val, idx)) === false)
|
|
69
|
+
if ((await iterator(array[idx], idx)) === false)
|
|
72
70
|
break;
|
|
73
71
|
}
|
|
74
72
|
}
|
package/lib/es/async.js
CHANGED
package/lib/es/base64.js
CHANGED
package/lib/es/clipboard.js
CHANGED
package/lib/es/cloneDeep.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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.10.
|
|
2
|
+
* sculp-js v1.10.5
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -106,31 +106,31 @@ function scalingByAspectRatio({ sizeKB, maxSize, originWidth, originHeight }) {
|
|
|
106
106
|
return { width: targetWidth, height: targetHeight };
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
|
-
* Web端:等比例压缩图片批量处理 (
|
|
109
|
+
* Web端:等比例压缩图片批量处理 (小于minFileSizeKB:50,不压缩), 支持压缩全景图或长截图
|
|
110
110
|
*
|
|
111
111
|
* 1. 默认根据图片原始size及宽高适当地调整quality、width、height
|
|
112
112
|
* 2. 可指定压缩的图片质量 quality(若不指定则根据原始图片大小来计算), 来适当调整width、height
|
|
113
113
|
* 3. 可指定压缩的图片最大宽高 maxSize(若不指定则根据原始图片宽高来计算), 满足大屏幕图片展示的场景
|
|
114
114
|
*
|
|
115
115
|
* @param {File | FileList} file 图片或图片数组
|
|
116
|
-
* @param {ICompressOptions} options 压缩图片配置项,default: {mime:'image/jpeg'}
|
|
117
|
-
* @returns {Promise<
|
|
116
|
+
* @param {ICompressOptions} options 压缩图片配置项,default: {mime:'image/jpeg', minFileSizeKB: 50}
|
|
117
|
+
* @returns {Promise<ICompressImgResult | ICompressImgResult[] | null>}
|
|
118
118
|
*/
|
|
119
|
-
function compressImg(file, options = { mime: 'image/jpeg' }) {
|
|
119
|
+
function compressImg(file, options = { mime: 'image/jpeg', minFileSizeKB: 50 }) {
|
|
120
120
|
if (!(file instanceof File || file instanceof FileList)) {
|
|
121
121
|
throw new Error(`${file} require be File or FileList`);
|
|
122
122
|
}
|
|
123
123
|
else if (!supportCanvas()) {
|
|
124
124
|
throw new Error(`Current runtime environment not support Canvas`);
|
|
125
125
|
}
|
|
126
|
-
const { quality, mime = 'image/jpeg', maxSize: size } = isObject(options) ? options : {};
|
|
126
|
+
const { quality, mime = 'image/jpeg', maxSize: size, minFileSizeKB = 50 } = isObject(options) ? options : {};
|
|
127
127
|
let targetQuality = quality, maxSize;
|
|
128
128
|
if (quality) {
|
|
129
129
|
targetQuality = quality;
|
|
130
130
|
}
|
|
131
131
|
else if (file instanceof File) {
|
|
132
132
|
const sizeKB = +parseInt((file.size / 1024).toFixed(2));
|
|
133
|
-
if (sizeKB <
|
|
133
|
+
if (sizeKB < minFileSizeKB) {
|
|
134
134
|
targetQuality = 1;
|
|
135
135
|
}
|
|
136
136
|
else if (sizeKB < 1 * 1024) {
|
|
@@ -158,7 +158,7 @@ function compressImg(file, options = { mime: 'image/jpeg' }) {
|
|
|
158
158
|
};
|
|
159
159
|
const fileName = [...file.name.split('.').slice(0, -1), ext[mime]].join('.');
|
|
160
160
|
const sizeKB = +parseInt((file.size / 1024).toFixed(2));
|
|
161
|
-
if (sizeKB <
|
|
161
|
+
if (sizeKB < minFileSizeKB) {
|
|
162
162
|
resolve({
|
|
163
163
|
file: file
|
|
164
164
|
});
|
|
@@ -194,7 +194,7 @@ function compressImg(file, options = { mime: 'image/jpeg' }) {
|
|
|
194
194
|
origin: file,
|
|
195
195
|
beforeSrc: src,
|
|
196
196
|
afterSrc: canvasURL,
|
|
197
|
-
beforeKB:
|
|
197
|
+
beforeKB: sizeKB,
|
|
198
198
|
afterKB: Number((miniFile.size / 1024).toFixed(2))
|
|
199
199
|
});
|
|
200
200
|
};
|
|
@@ -204,6 +204,7 @@ function compressImg(file, options = { mime: 'image/jpeg' }) {
|
|
|
204
204
|
}
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
|
+
return Promise.resolve(null);
|
|
207
208
|
}
|
|
208
209
|
|
|
209
210
|
export { chooseLocalFile, compressImg, supportCanvas };
|
package/lib/es/func.js
CHANGED
package/lib/es/index.js
CHANGED
package/lib/es/isEqual.js
CHANGED