amos-tool 1.4.4 → 1.4.8

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 (100) hide show
  1. package/.prettierignore +2 -2
  2. package/.prettierrc +50 -50
  3. package/README.md +667 -653
  4. package/apis/objectPath.md +129 -129
  5. package/index.d.ts +50 -5
  6. package/index.js +3 -3
  7. package/lib/_browser.js +10 -8
  8. package/lib/_clone.js +67 -62
  9. package/lib/_cookie.js +35 -32
  10. package/lib/_deepCopy.js +17 -29
  11. package/lib/_deepEqual.js +6 -13
  12. package/lib/_fastDeepEqual.js +28 -44
  13. package/lib/_flashSupport.js +13 -10
  14. package/lib/_forOwn.js +8 -7
  15. package/lib/_funcThrottle.js +16 -15
  16. package/lib/_isnode.js +2 -1
  17. package/lib/_list.js +55 -67
  18. package/lib/_object.assign.js +14 -24
  19. package/lib/_object.entries.js +6 -5
  20. package/lib/_object.values.js +5 -4
  21. package/lib/_omit.js +12 -12
  22. package/lib/_parseJson.js +7 -6
  23. package/lib/_pick.js +14 -0
  24. package/lib/_queue.js +24 -21
  25. package/lib/_shallowCopy.js +24 -23
  26. package/lib/_stringify.js +14 -17
  27. package/lib/_supportWs.js +5 -5
  28. package/lib/_trim.js +5 -4
  29. package/lib/_typeOfList.js +22 -21
  30. package/lib/_uuids.js +30 -35
  31. package/lib/amostool.js +15 -63
  32. package/lib/array2tree.js +9 -10
  33. package/lib/arrayFilter.js +17 -20
  34. package/lib/arrayUtils.js +13 -11
  35. package/lib/browser/Cookie.js +34 -35
  36. package/lib/browser/indexDB.js +71 -82
  37. package/lib/browserSupport.js +76 -71
  38. package/lib/completeUnit.js +7 -4
  39. package/lib/consts.js +2 -1
  40. package/lib/dom/canvas2img.js +61 -73
  41. package/lib/dom/canvasTools.js +9 -14
  42. package/lib/dom/downloadFile.js +15 -12
  43. package/lib/dom/eventHelper.js +8 -6
  44. package/lib/dom/fileBlob.js +14 -14
  45. package/lib/dom/fileSaveAs.js +54 -61
  46. package/lib/dom/getFontSize.js +7 -10
  47. package/lib/dom/minfyImg.js +30 -25
  48. package/lib/encrypt/_base64.js +32 -25
  49. package/lib/encrypt/_md5.js +68 -31
  50. package/lib/encrypt/des.js +426 -363
  51. package/lib/extra/_common.js +119 -166
  52. package/lib/extra/filterNull.js +3 -2
  53. package/lib/extra/find.js +10 -11
  54. package/lib/extra/index.js +4 -3
  55. package/lib/extra/memo.js +18 -0
  56. package/lib/extra/pathToTree.js +48 -42
  57. package/lib/extra/pwdStrength.js +4 -2
  58. package/lib/extra/sortBy.js +28 -30
  59. package/lib/flat.js +15 -0
  60. package/lib/locationParams.js +94 -99
  61. package/lib/log.js +20 -26
  62. package/lib/math/_keyColor.js +154 -0
  63. package/lib/math/addition.js +9 -7
  64. package/lib/math/amountCase.js +8 -12
  65. package/lib/math/coinFormat.js +7 -5
  66. package/lib/math/colorUtil.js +96 -92
  67. package/lib/math/dateTime.js +76 -94
  68. package/lib/math/operations.js +33 -37
  69. package/lib/math/pwdStrength.js +4 -2
  70. package/lib/math/randomColor.js +17 -5
  71. package/lib/math/subtraction.js +10 -9
  72. package/lib/merged.js +9 -9
  73. package/lib/objectPath.js +88 -95
  74. package/lib/parseText.js +8 -7
  75. package/lib/png/Identicon.js +36 -38
  76. package/lib/png/pnglib.js +58 -32
  77. package/lib/png/randomPic.js +9 -12
  78. package/lib/positionFactory.js +25 -80
  79. package/lib/pwdPolicy.js +27 -31
  80. package/lib/qs/_assign.js +7 -5
  81. package/lib/qs/_merge.js +19 -28
  82. package/lib/qs/_tools.js +3 -2
  83. package/lib/qs/formats.js +6 -5
  84. package/lib/qs/index.js +4 -4
  85. package/lib/qs/parse.js +55 -50
  86. package/lib/qs/stringify.js +55 -77
  87. package/lib/qs/utils.js +69 -88
  88. package/lib/random.js +5 -4
  89. package/lib/shallowEqual.js +24 -34
  90. package/lib/store.js +93 -98
  91. package/lib/strUtils.js +51 -42
  92. package/lib/tableFilter.js +178 -169
  93. package/lib/throttleDebounce.js +18 -22
  94. package/lib/url/encodeUrl.js +5 -4
  95. package/lib/url/restfulUrl.js +8 -7
  96. package/lib/utils.js +169 -223
  97. package/lib/xss/htmlEncode.js +3 -2
  98. package/lib/xss/implementEncode.js +36 -37
  99. package/lib/xss/index.js +4 -3
  100. package/package.json +9 -8
package/lib/_queue.js CHANGED
@@ -1,65 +1,68 @@
1
1
  "use strict";
2
2
 
3
3
  function _ArrayHigh(r) {
4
- this.array = void 0 === r ? [] : new Array(r)
4
+ this.array = void 0 === r ? [] : new Array(r);
5
5
  }
6
+
6
7
  _ArrayHigh.prototype = {
7
8
  length: function() {
8
- return this.array.length
9
+ return this.array.length;
9
10
  },
10
11
  at: function(r) {
11
- return this.array[r]
12
+ return this.array[r];
12
13
  },
13
14
  set: function(r, t) {
14
- this.array[r] = t
15
+ this.array[r] = t;
15
16
  },
16
17
  push: function(r) {
17
- return this.array.push(r)
18
+ return this.array.push(r);
18
19
  },
19
20
  slice: function(r, t) {
20
- return this.array = this.array.slice(r, t)
21
+ return this.array = this.array.slice(r, t);
21
22
  },
22
23
  concat: function(r) {
23
- this.array = this.array.concat(r)
24
+ this.array = this.array.concat(r);
24
25
  },
25
26
  remove: function(r, t) {
26
- t = void 0 === t ? 1 : t, this.array.splice(r, t)
27
+ t = void 0 === t ? 1 : t, this.array.splice(r, t);
27
28
  },
28
29
  join: function(r) {
29
- return this.array.join(r)
30
+ return this.array.join(r);
30
31
  },
31
32
  clear: function() {
32
- this.array.length = 0
33
+ this.array.length = 0;
33
34
  }
34
35
  };
36
+
35
37
  var Queue = function() {
36
- this._array_h = new _ArrayHigh
38
+ this._array_h = new _ArrayHigh;
37
39
  };
40
+
38
41
  Queue.prototype = {
39
42
  _index: 0,
40
43
  push: function(r) {
41
- this._array_h.push(r)
44
+ this._array_h.push(r);
42
45
  },
43
46
  pop: function() {
44
47
  var r = null;
45
- return this._array_h.length() && (r = this._array_h.at(this._index), 2 * ++this._index >= this._array_h.length() && (this._array_h.slice(this._index), this._index = 0)), r
48
+ return this._array_h.length() && (r = this._array_h.at(this._index), 2 * ++this._index >= this._array_h.length() && (this._array_h.slice(this._index),
49
+ this._index = 0)), r;
46
50
  },
47
51
  head: function() {
48
- var r = null,
49
- t = this._array_h.length();
50
- return t && (r = this._array_h.at(t - 1)), r
52
+ var r = null, t = this._array_h.length();
53
+ return t && (r = this._array_h.at(t - 1)), r;
51
54
  },
52
55
  tail: function() {
53
56
  var r = null;
54
- return this._array_h.length() && (r = this._array_h.at(this._index)), r
57
+ return this._array_h.length() && (r = this._array_h.at(this._index)), r;
55
58
  },
56
59
  length: function() {
57
- return this._array_h.length() - this._index
60
+ return this._array_h.length() - this._index;
58
61
  },
59
62
  empty: function() {
60
- return 0 === this._array_h.length()
63
+ return 0 === this._array_h.length();
61
64
  },
62
65
  clear: function() {
63
- this._array_h.clear()
66
+ this._array_h.clear();
64
67
  }
65
- }, module.exports = Queue;
68
+ }, module.exports = Queue;
@@ -1,56 +1,57 @@
1
1
  "use strict";
2
+
2
3
  var utils = require("./utils");
3
4
 
4
- function overArg(r, n) {
5
- return function(e) {
6
- return r(n(e))
7
- }
5
+ function overArg(e, r) {
6
+ return function(n) {
7
+ return e(r(n));
8
+ };
8
9
  }
9
- var nativeKeys = overArg(Object.keys, Object),
10
- hasOwnProperty = Object.prototype.hasOwnProperty;
10
+
11
+ var nativeKeys = overArg(Object.keys, Object), hasOwnProperty = Object.prototype.hasOwnProperty;
11
12
 
12
13
  function baseSlice(e, r, n) {
13
- var t = -1,
14
- o = e.length;
15
- r < 0 && (r = o < -r ? 0 : o + r), (n = o < n ? o : n) < 0 && (n += o), o = n < r ? 0 : n - r >>> 0, r >>>= 0;
16
- for (var a = Array(o); ++t < o;) a[t] = e[t + r];
17
- return a
14
+ var t = -1, o = e.length;
15
+ r < 0 && (r = -r > o ? 0 : o + r), (n = n > o ? o : n) < 0 && (n += o), o = r > n ? 0 : n - r >>> 0,
16
+ r >>>= 0;
17
+ for (var a = Array(o); ++t < o; ) a[t] = e[t + r];
18
+ return a;
18
19
  }
19
20
 
20
21
  function copyArray(e) {
21
- return baseSlice(e, 0, e.length)
22
+ return baseSlice(e, 0, e.length);
22
23
  }
23
24
 
24
25
  function baseAssignValue(e, r, n) {
25
- e[r] = n
26
+ e[r] = n;
26
27
  }
27
28
 
28
29
  function assignValue(e, r, n) {
29
30
  var t = e[r];
30
- hasOwnProperty.call(e, r) && eq(t, n) && (void 0 !== n || r in e) || baseAssignValue(e, r, n)
31
+ hasOwnProperty.call(e, r) && eq(t, n) && (void 0 !== n || r in e) || baseAssignValue(e, r, n);
31
32
  }
32
33
 
33
34
  function copyObject(e, r, n, t) {
34
35
  var o = !n;
35
- n = n || {};
36
- for (var a = -1, c = r.length; ++a < c;) {
37
- var i = r[a],
38
- s = t ? t(n[i], e[i], i, n, e) : void 0;
39
- void 0 === s && (s = e[i]), (o ? baseAssignValue : assignValue)(n, i, s)
36
+ n || (n = {});
37
+ for (var a = -1, c = r.length; ++a < c; ) {
38
+ var i = r[a], s = t ? t(n[i], e[i], i, n, e) : void 0;
39
+ void 0 === s && (s = e[i]), o ? baseAssignValue(n, i, s) : assignValue(n, i, s);
40
40
  }
41
- return n
41
+ return n;
42
42
  }
43
43
 
44
44
  function eq(e, r) {
45
- return e === r || e != e && r != r
45
+ return e === r || e != e && r != r;
46
46
  }
47
47
 
48
48
  function clone(e) {
49
- return utils.isObject(e) ? utils.isArray(e) ? copyArray(e) : copyObject(e, nativeKeys(e)) : e
49
+ return utils.isObject(e) ? utils.isArray(e) ? copyArray(e) : copyObject(e, nativeKeys(e)) : e;
50
50
  }
51
+
51
52
  module.exports = {
52
53
  clone: clone,
53
54
  copyArray: copyArray,
54
55
  copyObject: copyObject,
55
56
  eq: eq
56
- };
57
+ };
package/lib/_stringify.js CHANGED
@@ -1,19 +1,16 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(t) {
4
- return (_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
5
- return typeof t
6
- } : function(t) {
7
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t
8
- })(t)
9
- }
10
- module.exports = function(t) {
11
- if ("undefined" != typeof JSON && JSON.stringify) return JSON.stringify(t);
12
- var r = "",
13
- p = [];
14
- return function t(o) {
15
- var e = !1;
16
- for (var n in "[object Array]" === Object.prototype.toString.call(o) ? (p.push("]", "["), e = !0) : "[object Object]" === Object.prototype.toString.call(o) && p.push("}", "{"), o) "[object Null]" === Object.prototype.toString.call(o[n]) ? o[n] = "null" : "[object Undefined]" === Object.prototype.toString.call(o[n]) && (o[n] = "undefined"), o[n] && "object" === _typeof(o[n]) ? r += "," + (e ? "" : '"' + n + '":' + (e ? '"' : "")) + t(o[n]) : r += ',"' + (e ? "" : n + '":"') + o[n] + '"';
17
- return "" != r && (r = r.slice(1)), p.pop() + r + p.pop()
18
- }(t)
19
- };
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"), _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
4
+
5
+ module.exports = function(e) {
6
+ if ("undefined" != typeof JSON && JSON.stringify) return JSON.stringify(e);
7
+ var t = "", r = [];
8
+ return function e(o) {
9
+ var i = !1;
10
+ for (var n in "[object Array]" === Object.prototype.toString.call(o) ? (r.push("]", "["),
11
+ i = !0) : "[object Object]" === Object.prototype.toString.call(o) && r.push("}", "{"),
12
+ o) "[object Null]" === Object.prototype.toString.call(o[n]) ? o[n] = "null" : "[object Undefined]" === Object.prototype.toString.call(o[n]) && (o[n] = "undefined"),
13
+ o[n] && "object" === (0, _typeof2.default)(o[n]) ? t += "," + (i ? "" : '"' + n + '":' + (i ? '"' : "")) + e(o[n]) : t += ',"' + (i ? "" : n + '":"') + o[n] + '"';
14
+ return "" != t && (t = t.slice(1)), r.pop() + t + r.pop();
15
+ }(e);
16
+ };
package/lib/_supportWs.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
+
2
3
  module.exports = function() {
3
- var r = [/MQQBrowser[\/]5([.]\d+)?\sTBS/];
4
+ var r = [ /MQQBrowser[\/]5([.]\d+)?\sTBS/ ];
4
5
  if (!window.WebSocket) return !1;
5
- for (var e = window.navigator.userAgent, t = 0, n = r.length; t < n; t++)
6
- if (r[t].test(e)) return !1;
7
- return !0
8
- };
6
+ for (var e = window.navigator.userAgent, t = 0, n = r.length; t < n; t++) if (r[t].test(e)) return !1;
7
+ return !0;
8
+ };
package/lib/_trim.js CHANGED
@@ -2,9 +2,10 @@
2
2
 
3
3
  function makeTrim() {
4
4
  return String.prototype.trim ? function(t) {
5
- return t = "string" == typeof t ? t : "", String.prototype.trim.call(t)
5
+ return t = "string" == typeof t ? t : "", String.prototype.trim.call(t);
6
6
  } : function(t) {
7
- return (t = "string" == typeof t ? t : "").replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "")
8
- }
7
+ return (t = "string" == typeof t ? t : "").replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
8
+ };
9
9
  }
10
- module.exports = makeTrim();
10
+
11
+ module.exports = makeTrim();
@@ -1,26 +1,27 @@
1
1
  "use strict";
2
+
2
3
  var BUILTIN_OBJECT = {
3
- "[object Function]": 1,
4
- "[object RegExp]": 1,
5
- "[object Date]": 1,
6
- "[object Error]": 1,
7
- "[object CanvasGradient]": 1,
8
- "[object CanvasPattern]": 1,
9
- "[object Image]": 1,
10
- "[object Canvas]": 1
11
- },
12
- TYPED_ARRAY = {
13
- "[object Int8Array]": 1,
14
- "[object Uint8Array]": 1,
15
- "[object Uint8ClampedArray]": 1,
16
- "[object Int16Array]": 1,
17
- "[object Uint16Array]": 1,
18
- "[object Int32Array]": 1,
19
- "[object Uint32Array]": 1,
20
- "[object Float32Array]": 1,
21
- "[object Float64Array]": 1
22
- };
4
+ "[object Function]": 1,
5
+ "[object RegExp]": 1,
6
+ "[object Date]": 1,
7
+ "[object Error]": 1,
8
+ "[object CanvasGradient]": 1,
9
+ "[object CanvasPattern]": 1,
10
+ "[object Image]": 1,
11
+ "[object Canvas]": 1
12
+ }, TYPED_ARRAY = {
13
+ "[object Int8Array]": 1,
14
+ "[object Uint8Array]": 1,
15
+ "[object Uint8ClampedArray]": 1,
16
+ "[object Int16Array]": 1,
17
+ "[object Uint16Array]": 1,
18
+ "[object Int32Array]": 1,
19
+ "[object Uint32Array]": 1,
20
+ "[object Float32Array]": 1,
21
+ "[object Float64Array]": 1
22
+ };
23
+
23
24
  module.exports = {
24
25
  BUILTIN_OBJECT: BUILTIN_OBJECT,
25
26
  TYPED_ARRAY: TYPED_ARRAY
26
- };
27
+ };
package/lib/_uuids.js CHANGED
@@ -1,52 +1,47 @@
1
1
  "use strict";
2
- var CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),
3
- now = +new Date,
4
- index = 0,
5
- longtimeIndex = 0,
6
- formatDate = function() {
7
- var x = "yyyyMMddhhmm",
8
- e = new Date,
9
- t = {
10
- "M+": e.getMonth() + 1,
11
- "d+": e.getDate(),
12
- "h+": e.getHours(),
13
- "m+": e.getMinutes(),
14
- "s+": e.getSeconds(),
15
- S: e.getMilliseconds()
16
- };
17
- for (var n in /(y+)/.test(x) && (x = x.replace(RegExp.$1, (e.getFullYear() + "").substr(4 - RegExp.$1.length))), t) new RegExp("(" + n + ")").test(x) && (x = x.replace(RegExp.$1, 1 == RegExp.$1.length ? t[n] : ("00" + t[n]).substr(("" + t[n]).length)));
18
- return x
2
+
3
+ var CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""), now = +new Date, index = 0, longtimeIndex = 0, formatDate = function() {
4
+ var x = "yyyyMMddhhmm", e = new Date, t = {
5
+ "M+": e.getMonth() + 1,
6
+ "d+": e.getDate(),
7
+ "h+": e.getHours(),
8
+ "m+": e.getMinutes(),
9
+ "s+": e.getSeconds(),
10
+ S: e.getMilliseconds()
19
11
  };
12
+ for (var n in /(y+)/.test(x) && (x = x.replace(RegExp.$1, (e.getFullYear() + "").substr(4 - RegExp.$1.length))),
13
+ t) new RegExp("(" + n + ")").test(x) && (x = x.replace(RegExp.$1, 1 == RegExp.$1.length ? t[n] : ("00" + t[n]).substr(("" + t[n]).length)));
14
+ return x;
15
+ };
16
+
20
17
  module.exports = {
21
18
  uuid: function(x, e) {
22
- var t, n, r = CHARS,
23
- o = [];
24
- if (e = e || r.length, x)
25
- for (t = 0; t < x; t++) o[t] = r[0 | Math.random() * e];
26
- else
27
- for (o[8] = o[13] = o[18] = o[23] = "-", o[14] = "4", t = 0; t < 36; t++) o[t] || (n = 0 | 16 * Math.random(), o[t] = r[19 == t ? 3 & n | 8 : n]);
28
- return o.join("")
19
+ var t, n, r = CHARS, o = [];
20
+ if (e = e || r.length, x) for (t = 0; t < x; t++) o[t] = r[0 | Math.random() * e]; else for (o[8] = o[13] = o[18] = o[23] = "-",
21
+ o[14] = "4", t = 0; t < 36; t++) o[t] || (n = 0 | 16 * Math.random(), o[t] = r[19 == t ? 3 & n | 8 : n]);
22
+ return o.join("");
29
23
  },
30
24
  uuidFast: function() {
31
- for (var x, e = CHARS, t = new Array(36), n = 0, r = 0; r < 36; r++) 8 == r || 13 == r || 18 == r || 23 == r ? t[r] = "-" : 14 == r ? t[r] = "4" : (n <= 2 && (n = 33554432 + 16777216 * Math.random() | 0), x = 15 & n, n >>= 4, t[r] = e[19 == r ? 3 & x | 8 : x]);
32
- return t.join("")
25
+ for (var x, e = CHARS, t = new Array(36), n = 0, r = 0; r < 36; r++) 8 == r || 13 == r || 18 == r || 23 == r ? t[r] = "-" : 14 == r ? t[r] = "4" : (n <= 2 && (n = 33554432 + 16777216 * Math.random() | 0),
26
+ x = 15 & n, n >>= 4, t[r] = e[19 == r ? 3 & x | 8 : x]);
27
+ return t.join("");
33
28
  },
34
29
  uuidCompact: function() {
35
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(x) {
30
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (function(x) {
36
31
  var e = 16 * Math.random() | 0;
37
- return ("x" == x ? e : 3 & e | 8).toString(16)
38
- })
32
+ return ("x" == x ? e : 3 & e | 8).toString(16);
33
+ }));
39
34
  },
40
35
  timeUUID: function(x) {
41
- return (x = x || "amos-timeuuid") + "-" + now + "-" + ++index
36
+ return x || (x = "amos-timeuuid"), x + "-" + now + "-" + ++index;
42
37
  },
43
38
  longTimeUUID: function(x) {
44
- return (x = x || "longtime") + "-" + formatDate() + "-" + ++longtimeIndex
39
+ return x || (x = "longtime"), x + "-" + formatDate() + "-" + ++longtimeIndex;
45
40
  },
46
41
  otherUUID: function(x) {
47
- return (x = x || "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx").replace(/[xy]/g, function(x) {
42
+ return (x = x || "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx").replace(/[xy]/g, (function(x) {
48
43
  var e = 16 * Math.random() | 0;
49
- return ("x" == x ? e : 3 & e | 8).toString(16)
50
- }).replace(/\-/g, "")
44
+ return ("x" == x ? e : 3 & e | 8).toString(16);
45
+ })).replace(/\-/g, "");
51
46
  }
52
- };
47
+ };
package/lib/amostool.js CHANGED
@@ -1,62 +1,7 @@
1
1
  "use strict";
2
- var Base64 = require("./encrypt/_base64"),
3
- MD5 = require("./encrypt/_md5"),
4
- DES = require("./encrypt/des"),
5
- Browser = require("./_browser"),
6
- cloneTools = require("./_clone"),
7
- amosCookie = require("./_cookie"),
8
- deepCopy = require("./_deepCopy"),
9
- deepEqual = require("./_deepEqual"),
10
- _fastDeepEqual = require("./_fastDeepEqual"),
11
- funcThrottle = require("./_funcThrottle"),
12
- isNode = require("./_isnode"),
13
- List = require("./_list"),
14
- _objectAssign = require("./_object.assign"),
15
- _objectEntries = require("./_object.entries"),
16
- _objectValues = require("./_object.values"),
17
- omit = require("./_omit"),
18
- parseJson = require("./_parseJson"),
19
- Queue = require("./_queue"),
20
- stringify = require("./_stringify"),
21
- supportWs = require("./_supportWs"),
22
- trim = require("./_trim"),
23
- UUID = require("./_uuids"),
24
- array2tree = require("./array2tree"),
25
- arrayFilter = require("./arrayFilter"),
26
- browserSupport = require("./browserSupport"),
27
- completeUnit = require("./completeUnit"),
28
- consts = require("./consts"),
29
- LocationParam = require("./locationParams"),
30
- Log = require("./log"),
31
- merged = require("./merged"),
32
- objectPath = require("./objectPath"),
33
- parseText = require("./parseText"),
34
- pwdPolicy = require("./pwdPolicy"),
35
- random = require("./random"),
36
- shallowEqual = require("./shallowEqual"),
37
- Store = require("./store"),
38
- strUtils = require("./strUtils"),
39
- tableFilter = require("./tableFilter"),
40
- utils = require("./utils"),
41
- canvas2img = require("./dom/canvas2img"),
42
- fileSaveAs = require("./dom/fileSaveAs"),
43
- minfyImg = require("./dom/minfyImg"),
44
- eventHelper = require("./dom/eventHelper"),
45
- downloadFile = require("./dom/downloadFile"),
46
- canvasTools = require("./dom/canvasTools"),
47
- amountCase = require("./math/amountCase"),
48
- colorUtil = require("./math/colorUtil"),
49
- pwdStrength = require("./math/pwdStrength"),
50
- randomColor = require("./math/randomColor"),
51
- addition = require("./math/addition"),
52
- subtraction = require("./math/subtraction"),
53
- coinFormat = require("./math/coinFormat"),
54
- dateTime = require("./math/dateTime"),
55
- qs = require("./qs"),
56
- encodeUrl = require("./url/encodeUrl"),
57
- restfulUrl = require("./url/restfulUrl"),
58
- positionFactory = require("./positionFactory"),
59
- throttleDebounce = require("./throttleDebounce");
2
+
3
+ var Base64 = require("./encrypt/_base64"), MD5 = require("./encrypt/_md5"), DES = require("./encrypt/des"), Browser = require("./_browser"), cloneTools = require("./_clone"), amosCookie = require("./_cookie"), deepCopy = require("./_deepCopy"), deepEqual = require("./_deepEqual"), _fastDeepEqual = require("./_fastDeepEqual"), funcThrottle = require("./_funcThrottle"), isNode = require("./_isnode"), List = require("./_list"), _objectAssign = require("./_object.assign"), _objectEntries = require("./_object.entries"), _objectValues = require("./_object.values"), omit = require("./_omit"), pick = require("./_pick"), parseJson = require("./_parseJson"), Queue = require("./_queue"), shallowCopy = require("./_shallowCopy"), stringify = require("./_stringify"), supportWs = require("./_supportWs"), trim = require("./_trim"), UUID = require("./_uuids"), array2tree = require("./array2tree"), arrayFilter = require("./arrayFilter"), arrayUtils = require("./arrayUtils"), browserSupport = require("./browserSupport"), completeUnit = require("./completeUnit"), consts = require("./consts"), flat = require("./flat"), LocationParam = require("./locationParams"), Log = require("./log"), merged = require("./merged"), objectPath = require("./objectPath"), parseText = require("./parseText"), pwdPolicy = require("./pwdPolicy"), random = require("./random"), shallowEqual = require("./shallowEqual"), Store = require("./store"), strUtils = require("./strUtils"), tableFilter = require("./tableFilter"), utils = require("./utils"), canvas2img = require("./dom/canvas2img"), canvasTools = require("./dom/canvasTools"), downloadFile = require("./dom/downloadFile"), eventHelper = require("./dom/eventHelper"), fileBlob = require("./dom/fileBlob"), fileSaveAs = require("./dom/fileSaveAs"), getFontSize = require("./dom/getFontSize"), minfyImg = require("./dom/minfyImg"), addition = require("./math/addition"), amountCase = require("./math/amountCase"), coinFormat = require("./math/coinFormat"), colorUtil = require("./math/colorUtil"), dateTime = require("./math/dateTime"), pwdStrength = require("./math/pwdStrength"), randomColor = require("./math/randomColor"), subtraction = require("./math/subtraction"), qs = require("./qs"), encodeUrl = require("./url/encodeUrl"), restfulUrl = require("./url/restfulUrl"), positionFactory = require("./positionFactory"), throttleDebounce = require("./throttleDebounce"), checkFlash = require("./_flashSupport");
4
+
60
5
  module.exports = {
61
6
  Base64: Base64,
62
7
  MD5: MD5,
@@ -74,18 +19,22 @@ module.exports = {
74
19
  objectEntries: _objectEntries,
75
20
  objectValues: _objectValues,
76
21
  omit: omit,
22
+ pick: pick,
77
23
  parseJson: parseJson,
78
24
  Queue: Queue,
25
+ shallowCopy: shallowCopy,
79
26
  stringify: stringify,
80
27
  supportWs: supportWs,
81
28
  trim: trim,
82
29
  UUID: UUID,
83
30
  array2tree: array2tree,
84
31
  arrayFilter: arrayFilter,
32
+ arrayUtils: arrayUtils,
85
33
  browerSupport: browserSupport,
86
34
  browserSupport: browserSupport,
87
35
  completeUnit: completeUnit,
88
36
  consts: consts,
37
+ flat: flat,
89
38
  LocationParam: LocationParam,
90
39
  Log: Log,
91
40
  merged: merged,
@@ -99,11 +48,13 @@ module.exports = {
99
48
  tableFilter: tableFilter,
100
49
  utils: utils,
101
50
  canvas2img: canvas2img,
51
+ canvasTools: canvasTools,
52
+ downloadFile: downloadFile,
53
+ eventHelper: eventHelper,
54
+ fileBlob: fileBlob,
102
55
  fileSaveAs: fileSaveAs,
56
+ getFontSize: getFontSize,
103
57
  minfyImg: minfyImg,
104
- eventHelper: eventHelper,
105
- downloadFile: downloadFile,
106
- canvasTools: canvasTools,
107
58
  amountCase: amountCase,
108
59
  colorUtil: colorUtil,
109
60
  pwdStrength: pwdStrength,
@@ -116,5 +67,6 @@ module.exports = {
116
67
  encodeUrl: encodeUrl,
117
68
  restfulUrl: restfulUrl,
118
69
  positionFactory: positionFactory,
119
- throttleDebounce: throttleDebounce
120
- };
70
+ throttleDebounce: throttleDebounce,
71
+ checkFlash: checkFlash
72
+ };
package/lib/array2tree.js CHANGED
@@ -2,15 +2,14 @@
2
2
 
3
3
  function array2tree(e, r, n) {
4
4
  (n = n || {}).childrenKeyName = n.childrenKeyName || "children";
5
- var t, i = e || [],
6
- a = [],
7
- l = 0;
5
+ var t, i = e || [], a = [], l = 0;
8
6
  do {
9
- if (!(t = i.filter(function(e) {
10
- return r(e, l)
11
- })[0])) break;
12
- a.push(t), i = t[n.childrenKeyName] || [], l += 1
13
- } while (0 < i.length);
14
- return a
7
+ if (!(t = i.filter((function(e) {
8
+ return r(e, l);
9
+ }))[0])) break;
10
+ a.push(t), i = t[n.childrenKeyName] || [], l += 1;
11
+ } while (i.length > 0);
12
+ return a;
15
13
  }
16
- module.exports = array2tree;
14
+
15
+ module.exports = array2tree;
@@ -1,31 +1,28 @@
1
1
  "use strict";
2
+
2
3
  var _utils = require("./utils");
3
4
 
4
5
  function arrayFilter(r, e) {
5
- var a = (e = e || {}).key || "",
6
- t = e.value || "",
7
- n = e.childrenKey || "children",
8
- l = [];
9
- return function i(r) {
10
- r.forEach(function(r) {
11
- var e = r[n];
12
- e && _utils.isArray(e) ? i(e) : -1 < r[a].indexOf(t) && l.push(r)
13
- })
14
- }(r || []), l
6
+ var i = (e = e || {}).key || "", a = e.value || "", t = e.childrenKey || "children", n = [];
7
+ return function r(e) {
8
+ e.forEach((function(e) {
9
+ var l = e[t];
10
+ l && _utils.isArray(l) ? r(l) : e[i].indexOf(a) > -1 && n.push(e);
11
+ }));
12
+ }(r || []), n;
15
13
  }
16
14
 
17
15
  function arrayTreeFilter(r, e, i) {
18
16
  (i = i || {}).childrenKeyName = i.childrenKeyName || "children";
19
- var a = r || [],
20
- t = [],
21
- n = 0;
17
+ var a = r || [], t = [], n = 0;
22
18
  do {
23
- var l = a.filter(function(r) {
24
- return e(r, n)
25
- })[0];
19
+ var l = a.filter((function(r) {
20
+ return e(r, n);
21
+ }))[0];
26
22
  if (!l) break;
27
- t.push(l), a = l[i.childrenKeyName] || [], n += 1
28
- } while (0 < a.length);
29
- return t
23
+ t.push(l), a = l[i.childrenKeyName] || [], n += 1;
24
+ } while (a.length > 0);
25
+ return t;
30
26
  }
31
- module.exports = arrayFilter, module.exports.arrayTreeFilter = arrayTreeFilter;
27
+
28
+ module.exports = arrayFilter, module.exports.arrayTreeFilter = arrayTreeFilter;
package/lib/arrayUtils.js CHANGED
@@ -1,20 +1,22 @@
1
1
  "use strict";
2
+
2
3
  var deepCopy = require("./_deepCopy");
4
+
3
5
  module.exports = {
4
- arrayIntersection: function(r) {
5
- if (0 < arguments.length) {
6
- for (var e = deepCopy(r), t = 1; t < arguments.length; t++) {
7
- var n = arguments[t];
8
- Array.isArray(n) || console.error(n + "不是数组,不能求交集"), e = e.filter(function(r, e) {
9
- return 0 <= n.indexOf(r)
10
- })
6
+ arrayIntersection: function() {
7
+ if (arguments.length > 0) {
8
+ for (var r = deepCopy(arguments[0]), e = 1; e < arguments.length; e++) {
9
+ var t = arguments[e];
10
+ Array.isArray(t) || console.error(t + "不是数组,不能求交集"), r = r.filter((function(r, e) {
11
+ return t.indexOf(r) >= 0;
12
+ }));
11
13
  }
12
- return e
14
+ return r;
13
15
  }
14
- return []
16
+ return [];
15
17
  },
16
18
  arrayToObject: function(r, e) {
17
19
  for (var t = e && e.plainObjects ? Object.create(null) : {}, n = 0; n < r.length; ++n) void 0 !== r[n] && (t[n] = r[n]);
18
- return t
20
+ return t;
19
21
  }
20
- };
22
+ };