util-helpers 4.21.5 → 4.21.6

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/esm/VERSION.js CHANGED
@@ -1,4 +1,4 @@
1
- var VERSION = "4.21.5";
1
+ var VERSION = "4.21.6";
2
2
  var VERSION$1 = VERSION;
3
3
 
4
4
  export { VERSION$1 as default };
@@ -1,5 +1,6 @@
1
1
  import { toNumber } from 'ut2';
2
2
  import loadImageWithBlob from './loadImageWithBlob.js';
3
+ import { nativeUndefined } from './utils/native.js';
3
4
 
4
5
  function canvasToBlob(canvas, type, quality) {
5
6
  return new Promise(function (resolve) {
@@ -41,7 +42,7 @@ var compressImage = function (img, options) {
41
42
  ctx.fillRect(0, 0, canvas.width, canvas.height);
42
43
  }
43
44
  var internalOffset = [0, 0];
44
- if (rotate !== undefined) {
45
+ if (rotate !== nativeUndefined) {
45
46
  ctx.translate(image.width / 2, image.height / 2);
46
47
  internalOffset = [-image.width / 2, -image.height / 2];
47
48
  ctx.rotate((rotate * Math.PI) / 180);
package/esm/download.js CHANGED
@@ -3,7 +3,7 @@ import { isBlob, isPromiseLike } from 'ut2';
3
3
  import dataURLToBlob from './dataURLToBlob.js';
4
4
  import isUrl from './isUrl.js';
5
5
  import ajax from './ajax.js';
6
- import { createObjectURL, revokeObjectURL } from './utils/native.js';
6
+ import { createObjectURL, revokeObjectURL, nativeUndefined } from './utils/native.js';
7
7
 
8
8
  function saver(blobUrl, fileName) {
9
9
  if (fileName === void 0) { fileName = ''; }
@@ -59,7 +59,7 @@ function download(data, options) {
59
59
  case 5:
60
60
  res = _a.sent();
61
61
  currentFileName = fileName || data.split('?')[0].split('#')[0].split('/').pop();
62
- return [2, download(res, { fileName: currentFileName, type: type || (isBlob(res) ? res.type : undefined) })];
62
+ return [2, download(res, { fileName: currentFileName, type: type || (isBlob(res) ? res.type : nativeUndefined) })];
63
63
  case 6:
64
64
  payload = new Blob([data], { type: type || 'text/plain' });
65
65
  _a.label = 7;
package/esm/index.js CHANGED
@@ -64,6 +64,6 @@ export { default as findTreeSelect } from './findTreeSelect.js';
64
64
  export { setDisableWarning } from './utils/config.js';
65
65
  export { default as VERSION } from './VERSION.js';
66
66
 
67
- var version = "4.21.5";
67
+ var version = "4.21.6";
68
68
 
69
69
  export { version };
package/esm/isChinese.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { toString } from 'ut2';
2
- import { objectValues } from './utils/native.js';
2
+ import { objectValues, nativeUndefined } from './utils/native.js';
3
3
 
4
4
  var chineseDictionary = {
5
5
  chineseBasic: '[\u4e00-\u9fa5]',
@@ -29,7 +29,7 @@ function isChinese(value, options) {
29
29
  var extendRegExp = loose ? looseChineseExtendRegExp : chineseExtendRegExp;
30
30
  var hasExtend = useExtend && supportRegExpUnicode;
31
31
  var resultRegExp = hasExtend ? extendRegExp : basicRegExp;
32
- var flag = hasExtend ? 'u' : undefined;
32
+ var flag = hasExtend ? 'u' : nativeUndefined;
33
33
  var reg = new RegExp(resultRegExp, flag);
34
34
  return reg.test(valueStr);
35
35
  }
@@ -1,9 +1,10 @@
1
1
  import { constant, noop } from 'ut2';
2
2
  import { URLExisted } from './setup.js';
3
3
 
4
+ var nativeUndefined = void 0;
4
5
  var objectKeys = Object.keys;
5
6
  var objectValues = Object.values;
6
7
  var createObjectURL = URLExisted ? URL.createObjectURL : constant('');
7
8
  var revokeObjectURL = URLExisted ? URL.revokeObjectURL : noop;
8
9
 
9
- export { createObjectURL, objectKeys, objectValues, revokeObjectURL };
10
+ export { createObjectURL, nativeUndefined, objectKeys, objectValues, revokeObjectURL };
package/lib/VERSION.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var VERSION = "4.21.5";
3
+ var VERSION = "4.21.6";
4
4
  var VERSION$1 = VERSION;
5
5
 
6
6
  module.exports = VERSION$1;
@@ -2,6 +2,7 @@
2
2
 
3
3
  var ut2 = require('ut2');
4
4
  var loadImageWithBlob = require('./loadImageWithBlob.js');
5
+ var native = require('./utils/native.js');
5
6
 
6
7
  function canvasToBlob(canvas, type, quality) {
7
8
  return new Promise(function (resolve) {
@@ -43,7 +44,7 @@ var compressImage = function (img, options) {
43
44
  ctx.fillRect(0, 0, canvas.width, canvas.height);
44
45
  }
45
46
  var internalOffset = [0, 0];
46
- if (rotate !== undefined) {
47
+ if (rotate !== native.nativeUndefined) {
47
48
  ctx.translate(image.width / 2, image.height / 2);
48
49
  internalOffset = [-image.width / 2, -image.height / 2];
49
50
  ctx.rotate((rotate * Math.PI) / 180);
package/lib/download.js CHANGED
@@ -61,7 +61,7 @@ function download(data, options) {
61
61
  case 5:
62
62
  res = _a.sent();
63
63
  currentFileName = fileName || data.split('?')[0].split('#')[0].split('/').pop();
64
- return [2, download(res, { fileName: currentFileName, type: type || (ut2.isBlob(res) ? res.type : undefined) })];
64
+ return [2, download(res, { fileName: currentFileName, type: type || (ut2.isBlob(res) ? res.type : native.nativeUndefined) })];
65
65
  case 6:
66
66
  payload = new Blob([data], { type: type || 'text/plain' });
67
67
  _a.label = 7;
package/lib/index.js CHANGED
@@ -66,7 +66,7 @@ var findTreeSelect = require('./findTreeSelect.js');
66
66
  var config = require('./utils/config.js');
67
67
  var VERSION = require('./VERSION.js');
68
68
 
69
- exports.version = "4.21.5";
69
+ exports.version = "4.21.6";
70
70
 
71
71
  exports.isMobile = isMobile;
72
72
  exports.isTelephone = isTelephone;
package/lib/isChinese.js CHANGED
@@ -31,7 +31,7 @@ function isChinese(value, options) {
31
31
  var extendRegExp = loose ? looseChineseExtendRegExp : chineseExtendRegExp;
32
32
  var hasExtend = useExtend && supportRegExpUnicode;
33
33
  var resultRegExp = hasExtend ? extendRegExp : basicRegExp;
34
- var flag = hasExtend ? 'u' : undefined;
34
+ var flag = hasExtend ? 'u' : native.nativeUndefined;
35
35
  var reg = new RegExp(resultRegExp, flag);
36
36
  return reg.test(valueStr);
37
37
  }
@@ -3,6 +3,7 @@
3
3
  var ut2 = require('ut2');
4
4
  var setup = require('./setup.js');
5
5
 
6
+ exports.nativeUndefined = void 0;
6
7
  exports.objectKeys = Object.keys;
7
8
  exports.objectValues = Object.values;
8
9
  exports.createObjectURL = setup.URLExisted ? URL.createObjectURL : ut2.constant('');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "util-helpers",
3
- "version": "4.21.5",
3
+ "version": "4.21.6",
4
4
  "description": "一个基于业务场景的工具方法库",
5
5
  "main": "lib/index.js",
6
6
  "module": "esm/index.js",
@@ -1,3 +1,4 @@
1
+ export declare const nativeUndefined: undefined;
1
2
  export declare const objectKeys: {
2
3
  (o: object): string[];
3
4
  (o: {}): string[];