amos-tool 1.4.7 → 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 (131) hide show
  1. package/.prettierignore +2 -2
  2. package/.prettierrc +50 -50
  3. package/README.md +667 -667
  4. package/apis/objectPath.md +129 -129
  5. package/index.d.ts +11 -2
  6. package/index.js +3 -3
  7. package/lib/_browser.js +10 -8
  8. package/lib/_clone.js +68 -57
  9. package/lib/_cookie.js +50 -47
  10. package/lib/_deepCopy.js +14 -19
  11. package/lib/_deepEqual.js +7 -8
  12. package/lib/_fastDeepEqual.js +26 -34
  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 +74 -79
  18. package/lib/_object.assign.js +19 -19
  19. package/lib/_object.entries.js +8 -7
  20. package/lib/_object.values.js +8 -7
  21. package/lib/_omit.js +12 -11
  22. package/lib/_parseJson.js +7 -6
  23. package/lib/_pick.js +8 -7
  24. package/lib/_queue.js +24 -21
  25. package/lib/_shallowCopy.js +24 -23
  26. package/lib/_stringify.js +13 -10
  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 +4 -66
  32. package/lib/array2tree.js +9 -9
  33. package/lib/arrayFilter.js +18 -19
  34. package/lib/arrayUtils.js +10 -8
  35. package/lib/browser/Cookie.js +35 -36
  36. package/lib/browser/indexDB.js +72 -71
  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 -72
  41. package/lib/dom/canvasTools.js +11 -16
  42. package/lib/dom/downloadFile.js +17 -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 +27 -24
  48. package/lib/encrypt/_base64.js +32 -25
  49. package/lib/encrypt/_md5.js +68 -31
  50. package/lib/encrypt/des.js +430 -366
  51. package/lib/extra/_common.js +120 -161
  52. package/lib/extra/filterNull.js +5 -4
  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 +49 -36
  57. package/lib/extra/pwdStrength.js +4 -2
  58. package/lib/extra/sortBy.js +28 -30
  59. package/lib/flat.js +9 -13
  60. package/lib/locationParams.js +93 -95
  61. package/lib/log.js +20 -26
  62. package/lib/math/_keyColor.js +3 -1
  63. package/lib/math/addition.js +9 -7
  64. package/lib/math/amountCase.js +8 -12
  65. package/lib/math/coinFormat.js +6 -4
  66. package/lib/math/colorUtil.js +91 -94
  67. package/lib/math/dateTime.js +79 -97
  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 +81 -82
  74. package/lib/parseText.js +8 -7
  75. package/lib/png/Identicon.js +32 -28
  76. package/lib/png/pnglib.js +59 -34
  77. package/lib/png/randomPic.js +8 -14
  78. package/lib/positionFactory.js +28 -28
  79. package/lib/pwdPolicy.js +27 -31
  80. package/lib/qs/_assign.js +7 -5
  81. package/lib/qs/_merge.js +20 -23
  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 +56 -51
  86. package/lib/qs/stringify.js +54 -69
  87. package/lib/qs/utils.js +70 -83
  88. package/lib/random.js +5 -4
  89. package/lib/shallowEqual.js +25 -29
  90. package/lib/store.js +93 -95
  91. package/lib/strUtils.js +52 -43
  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 +171 -222
  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 +4 -4
  101. package/docs/Logger.html +0 -189
  102. package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  103. package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  104. package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  105. package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  106. package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  107. package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  108. package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  109. package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  110. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  111. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -978
  112. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  113. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  114. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  115. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  116. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -1049
  117. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  118. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  119. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  120. package/docs/global.html +0 -14535
  121. package/docs/index.html +0 -791
  122. package/docs/scripts/collapse.js +0 -20
  123. package/docs/scripts/linenumber.js +0 -25
  124. package/docs/scripts/nav.js +0 -12
  125. package/docs/scripts/polyfill.js +0 -4
  126. package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
  127. package/docs/scripts/prettify/lang-css.js +0 -2
  128. package/docs/scripts/prettify/prettify.js +0 -28
  129. package/docs/scripts/search.js +0 -83
  130. package/docs/styles/jsdoc.css +0 -765
  131. package/docs/styles/prettify.css +0 -79
package/lib/utils.js CHANGED
@@ -1,252 +1,200 @@
1
1
  "use strict";
2
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"),
3
- _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")),
4
- _typeOfList = require("./_typeOfList"),
5
- ObjProto = Object.prototype,
6
- toString = ObjProto.toString,
7
- hasOwnProperty = ObjProto.hasOwnProperty,
8
- nativeIsArray = Array.isArray,
9
- nativeKeys = Object.keys,
10
- BUILTIN_OBJECT = _typeOfList.BUILTIN_OBJECT,
11
- TYPED_ARRAY = _typeOfList.TYPED_ARRAY,
12
- property = function(t) {
13
- return function(e) {
14
- return null == e ? void 0 : e[t]
15
- }
16
- },
17
- MAX_ARRAY_INDEX = Math.pow(2, 53) - 1,
18
- getLength = property("length"),
19
- isArrayLike = function(e) {
20
- e = getLength(e);
21
- return "number" == typeof e && 0 <= e && e <= MAX_ARRAY_INDEX
22
- },
23
- isNumber = function(e) {
24
- var t = /^(\-|\+)?([0-9]+(\.[0-9]+)?|Infinity)$/.test(e),
25
- e = "number" == typeof e && !isNaN(e);
26
- return t || e
27
- },
28
- isFloat = function(e) {
29
- return /^-?\d+(\.\d+)?$/.test(e)
30
- },
31
- isOpacity = function(e) {
32
- return /^-?\d+(\.\d+)?$/.test(e)
33
- },
34
- toFloat = function(e) {
35
- return isNumber(e) ? Number(e) : Number(0)
36
- },
37
- isString = function(e) {
38
- return "[object String]" === toString.call(e)
39
- },
40
- isArray = nativeIsArray || function(e) {
41
- return "[object Array]" === toString.call(e)
42
- },
43
- isArguments = function(e) {
44
- return "[object Arguments]" === toString.call(e)
45
- },
46
- isObject = function(e) {
47
- var t = (0, _typeof2.default)(e);
48
- return "function" === t || "object" === t && !!e
49
- },
50
- isOnlyObject = function(e) {
51
- return "object" === (0, _typeof2.default)(e) && "[object Object]" === toString.call(e) && !!e
52
- },
53
- isBoolean = function(e) {
54
- return !0 === e || !1 === e || "[object Boolean]" === toString.call(e)
55
- },
56
- isFunction = function(e) {
57
- return "[object Function]" === toString.call(e)
58
- },
59
- isNull = function(e) {
60
- return null === e
61
- },
62
- isUndefined = function(e) {
63
- return void 0 === e
64
- },
65
- isNil = function(e) {
66
- return null == e
67
- },
68
- isEmptyObject = function(e) {
69
- if (e)
70
- for (var t in e)
71
- if (hasOwnProperty.call(e, t)) return !1;
72
- return !0
73
- },
74
- has = function(e, t) {
75
- if (!isArray(t)) return null != e && Object.prototype.hasOwnProperty.call(e, t);
76
- for (var n = t.length, r = 0; r < n; r++) {
77
- var i = t[r];
78
- if (null == e || !Object.prototype.hasOwnProperty.call(e, i)) return !1;
79
- e = e[i]
80
- }
81
- return !!n
82
- },
83
- keys = function(e) {
84
- if (!isObject(e)) return [];
85
- if (nativeKeys) return nativeKeys(e);
86
- var t, n = [];
87
- for (t in e) has(e, t) && n.push(t);
88
- return n
89
- },
90
- values = function(e) {
91
- for (var t = keys(e), n = t.length, r = Array(n), i = 0; i < n; i++) r[i] = e[t[i]];
92
- return r
93
- },
94
- noop = function() {},
95
- isEmpty = function(e) {
96
- return null == e || (isArrayLike(e) && (isArray(e) || isString(e) || isArguments(e)) ? 0 === e.length : 0 === keys(e).length)
97
- },
98
- isElement = function(e) {
99
- return !(!e || 1 !== e.nodeType)
100
- },
101
- isHTMLElement = function(e) {
102
- return window.HTMLElement || window.Element ? e instanceof(window.HTMLElement || window.Element) : e && "object" === ("undefined" == typeof n ? "undefined" : (0, _typeof2.default)(n)) && 1 === e.nodeType && "string" == typeof e.nodeName
103
- },
104
- isSVGElement = function(e) {
105
- return window.SVGElement && e instanceof window.SVGElement
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"), _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")), _typeOfList = require("./_typeOfList"), ObjProto = Object.prototype, toString = ObjProto.toString, hasOwnProperty = ObjProto.hasOwnProperty, nativeIsArray = Array.isArray, nativeKeys = Object.keys, BUILTIN_OBJECT = _typeOfList.BUILTIN_OBJECT, TYPED_ARRAY = _typeOfList.TYPED_ARRAY, property = function(e) {
4
+ return function(t) {
5
+ return null == t ? void 0 : t[e];
106
6
  };
7
+ }, MAX_ARRAY_INDEX = Math.pow(2, 53) - 1, getLength = property("length"), isArrayLike = function(e) {
8
+ var t = getLength(e);
9
+ return "number" == typeof t && t >= 0 && t <= MAX_ARRAY_INDEX;
10
+ }, isNumber = function(e) {
11
+ var t = /^(\-|\+)?([0-9]+(\.[0-9]+)?|Infinity)$/.test(e), n = "number" == typeof e && !isNaN(e);
12
+ return t || n;
13
+ }, isFloat = function(e) {
14
+ return /^-?\d+(\.\d+)?$/.test(e);
15
+ }, isOpacity = function(e) {
16
+ return /^-?\d+(\.\d+)?$/.test(e);
17
+ }, toFloat = function(e) {
18
+ return isNumber(e) ? Number(e) : Number(0);
19
+ }, isString = function(e) {
20
+ return "[object String]" === toString.call(e);
21
+ }, isArray = nativeIsArray || function(e) {
22
+ return "[object Array]" === toString.call(e);
23
+ }, isArguments = function(e) {
24
+ return "[object Arguments]" === toString.call(e);
25
+ }, isObject = function(e) {
26
+ var t = (0, _typeof2.default)(e);
27
+ return "function" === t || "object" === t && !!e;
28
+ }, isOnlyObject = function(e) {
29
+ return "object" === (0, _typeof2.default)(e) && "[object Object]" === toString.call(e) && !!e;
30
+ }, isBoolean = function(e) {
31
+ return !0 === e || !1 === e || "[object Boolean]" === toString.call(e);
32
+ }, isFunction = function(e) {
33
+ return "[object Function]" === toString.call(e);
34
+ }, isNull = function(e) {
35
+ return null === e;
36
+ }, isUndefined = function(e) {
37
+ return void 0 === e;
38
+ }, isNil = function(e) {
39
+ return null == e;
40
+ }, isEmptyObject = function(e) {
41
+ if (e) for (var t in e) if (hasOwnProperty.call(e, t)) return !1;
42
+ return !0;
43
+ }, has = function(e, t) {
44
+ if (!isArray(t)) return null != e && Object.prototype.hasOwnProperty.call(e, t);
45
+ for (var n = t.length, r = 0; r < n; r++) {
46
+ var i = t[r];
47
+ if (null == e || !Object.prototype.hasOwnProperty.call(e, i)) return !1;
48
+ e = e[i];
49
+ }
50
+ return !!n;
51
+ }, keys = function(e) {
52
+ if (!isObject(e)) return [];
53
+ if (nativeKeys) return nativeKeys(e);
54
+ var t = [];
55
+ for (var n in e) has(e, n) && t.push(n);
56
+ return t;
57
+ }, values = function(e) {
58
+ for (var t = keys(e), n = t.length, r = Array(n), i = 0; i < n; i++) r[i] = e[t[i]];
59
+ return r;
60
+ }, noop = function() {}, isEmpty = function(e) {
61
+ return null == e || (isArrayLike(e) && (isArray(e) || isString(e) || isArguments(e)) ? 0 === e.length : 0 === keys(e).length);
62
+ }, isElement = function(e) {
63
+ return !(!e || 1 !== e.nodeType);
64
+ }, isHTMLElement = function(e) {
65
+ return window.HTMLElement || window.Element ? e instanceof (window.HTMLElement || window.Element) : e && "object" === ("undefined" == typeof n ? "undefined" : (0,
66
+ _typeof2.default)(n)) && 1 === e.nodeType && "string" == typeof e.nodeName;
67
+ }, isSVGElement = function(e) {
68
+ return window.SVGElement && e instanceof window.SVGElement;
69
+ };
107
70
 
108
71
  function isDom(e) {
109
- return "object" === (0, _typeof2.default)(e) && "number" == typeof e.nodeType && "object" === (0, _typeof2.default)(e.ownerDocument)
72
+ return "object" === (0, _typeof2.default)(e) && "number" == typeof e.nodeType && "object" === (0,
73
+ _typeof2.default)(e.ownerDocument);
110
74
  }
111
75
 
112
76
  function isUrl(e) {
113
- return isString(e) && (/^https?:\/\/(?!\-)(?:(([0-9]{1,3}\.){3}[0-9]{1,3}))(:[0-9]{1,4}\/)?/.test(e) || /^https?:\/\/(?!\-)(?:[a-zA-Z\d\-]{0,62}[a-zA-Z\d]\.){1,126}(?!\d+)[a-zA-Z\d]{1,63}/.test(e))
77
+ return isString(e) && (/^https?:\/\/(?!\-)(?:(([0-9]{1,3}\.){3}[0-9]{1,3}))(:[0-9]{1,4}\/)?/.test(e) || /^https?:\/\/(?!\-)(?:[a-zA-Z\d\-]{0,62}[a-zA-Z\d]\.){1,126}(?!\d+)[a-zA-Z\d]{1,63}/.test(e));
114
78
  }
115
79
 
116
80
  function isBuiltInObject(e) {
117
- return !!BUILTIN_OBJECT[toString.call(e)]
81
+ return !!BUILTIN_OBJECT[toString.call(e)];
118
82
  }
83
+
119
84
  var null2default = function(e) {
120
- return isNull(e) || isUndefined(e) ? "" : e
121
- },
122
- isJson = function(e) {
123
- return "object" === (0, _typeof2.default)(e) && "[object object]" === toString.call(e).toLowerCase() && !e.length
124
- },
125
- stringIsJson = function e(t) {
126
- return "[object String]" === toString.call(t) && (t = t.replace(/\s/g, "").replace(/\n|\r/, ""), /^\{(.*?)\}$/.test(t) ? /"(.*?)":(.*?)/g.test(t) : !!/^\[(.*?)\]$/.test(t) && t.replace(/^\[/, "").replace(/\]$/, "").replace(/},{/g, "}\n{").split(/\n/).map(e).reduce(function(e, t) {
127
- return !!t
128
- }))
129
- },
130
- isKeyInObject = function(e, t) {
131
- isString(e) && (e = [e]);
132
- var n = 0;
133
- return e.forEach(function(e) {
134
- e in t && n++
135
- }), e.length === n
136
- },
137
- simpleEqual = function(e, t) {
138
- if (e === t) return !0;
139
- if ("object" !== (0, _typeof2.default)(e) || null === e || "object" !== (0, _typeof2.default)(t) || null === t) return !1;
140
- var n = nativeKeys(e),
141
- r = nativeKeys(t);
142
- if (n.length !== r.length) return !1;
143
- for (var i = hasOwnProperty.bind(t), o = 0; o < n.length; o++)
144
- if (!i(n[o]) || e[n[o]] !== t[n[o]]) return !1;
145
- return !0
146
- },
147
- isImageSrc = function() {
148
- var t = /data:image\/(jpe?g|png|gif|bmp|ico|tga);base64,/i,
149
- n = /.(jpe?g|png|gif|bmp|ico|tga)(\?.*)?$/i;
150
- return function(e) {
151
- return t.test(e) || n.test(e)
152
- }
153
- }(),
154
- encodeNumber = function(e) {
155
- var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 3,
156
- n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 4,
157
- r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : "*",
158
- i = String(e),
159
- e = t + n,
160
- n = r.repeat(n);
161
- return i.length > e ? i.substr(0, t) + n + i.substr(e) : i.substr(0, t) + n
162
- },
163
- getFileExtension = function(e) {
164
- if (e) {
165
- var t = e.lastIndexOf(".");
166
- return 0 < t ? e.substring(t + 1) : ""
167
- }
168
- return ""
169
- },
170
- some = function(e, t) {
171
- if (null == e) throw new TypeError;
172
- var n = Object(e),
173
- r = n.length >>> 0;
174
- if ("function" != typeof t) throw new TypeError;
175
- for (var i = 3 <= arguments.length ? arguments[2] : void 0, o = 0; o < r; o++)
176
- if (o in n && t.call(i, n[o], o, n)) return !0;
177
- return !1
178
- },
179
- every = function(e, t, n) {
180
- var r, i;
181
- if (null == e) throw new TypeError("arr is null or not defined");
182
- var o = Object(e),
183
- u = o.length >>> 0;
184
- if ("function" != typeof t) throw new TypeError;
185
- for (2 < arguments.length && (r = n), i = 0; i < u;) {
186
- if (i in o) {
187
- var s = o[i];
188
- if (!t.call(r, s, i, o)) return !1
189
- }
190
- i++
191
- }
192
- return !0
193
- },
194
- reduce = function(e, t) {
195
- if (null === e) throw new TypeError("Array.prototype.reduce called on null or undefined");
196
- if ("function" != typeof t) throw new TypeError(t + " is not a function");
197
- var n, r = Object(e),
198
- i = r.length >>> 0,
199
- o = 0;
200
- if (3 <= arguments.length) n = arguments[2];
201
- else {
202
- for (; o < i && !(o in r);) o++;
203
- if (i <= o) throw new TypeError("Reduce of empty array with no initial value");
204
- n = r[o++]
205
- }
206
- for (; o < i;) o in r && (n = t(n, r[o], o, r)), o++;
207
- return n
208
- },
209
- parse2string = function(e) {
210
- return isEmpty(e) ? "" : JSON.stringify(e)
211
- },
212
- parse2object = function(e) {
213
- return isEmpty(e) ? null : JSON.parse(e)
214
- },
215
- dataToArray = function(e) {
216
- return isArray(e) ? e : [e]
85
+ return isNull(e) || isUndefined(e) ? "" : e;
86
+ }, isJson = function(e) {
87
+ return "object" === (0, _typeof2.default)(e) && "[object object]" === toString.call(e).toLowerCase() && !e.length;
88
+ }, stringIsJson = function e(t) {
89
+ return "[object String]" === toString.call(t) && (t = t.replace(/\s/g, "").replace(/\n|\r/, ""),
90
+ /^\{(.*?)\}$/.test(t) ? /"(.*?)":(.*?)/g.test(t) : !!/^\[(.*?)\]$/.test(t) && t.replace(/^\[/, "").replace(/\]$/, "").replace(/},{/g, "}\n{").split(/\n/).map((function(t) {
91
+ return e(t);
92
+ })).reduce((function(e, t) {
93
+ return !!t;
94
+ })));
95
+ }, isKeyInObject = function(e, t) {
96
+ isString(e) && (e = [ e ]);
97
+ var n = 0;
98
+ return e.forEach((function(e) {
99
+ e in t && n++;
100
+ })), e.length === n;
101
+ }, simpleEqual = function(e, t) {
102
+ if (e === t) return !0;
103
+ if ("object" !== (0, _typeof2.default)(e) || null === e || "object" !== (0, _typeof2.default)(t) || null === t) return !1;
104
+ var n = nativeKeys(e), r = nativeKeys(t);
105
+ if (n.length !== r.length) return !1;
106
+ for (var i = hasOwnProperty.bind(t), o = 0; o < n.length; o++) if (!i(n[o]) || e[n[o]] !== t[n[o]]) return !1;
107
+ return !0;
108
+ }, isImageSrc = function() {
109
+ var e = /data:image\/(jpe?g|png|gif|bmp|ico|tga|svg(\+xml)?);base64,/i, t = /.(jpe?g|png|gif|bmp|ico|tga|svg)(\?.*)?$/i;
110
+ return function(n) {
111
+ return e.test(n) || t.test(n);
217
112
  };
113
+ }(), encodeNumber = function(e) {
114
+ var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 3, n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 4, r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : "*", i = String(e), o = t + n, u = r.repeat(n);
115
+ return i.length > o ? i.substr(0, t) + u + i.substr(o) : i.substr(0, t) + u;
116
+ }, getFileExtension = function(e) {
117
+ if (e) {
118
+ var t = e.lastIndexOf(".");
119
+ return t > 0 ? e.substring(t + 1) : "";
120
+ }
121
+ return "";
122
+ }, some = function(e, t) {
123
+ if (null == e) throw new TypeError;
124
+ var n = Object(e), r = n.length >>> 0;
125
+ if ("function" != typeof t) throw new TypeError;
126
+ for (var i = arguments.length >= 3 ? arguments[2] : void 0, o = 0; o < r; o++) if (o in n && t.call(i, n[o], o, n)) return !0;
127
+ return !1;
128
+ }, every = function(e, t, n) {
129
+ var r, i;
130
+ if (null == e) throw new TypeError("arr is null or not defined");
131
+ var o = Object(e), u = o.length >>> 0;
132
+ if ("function" != typeof t) throw new TypeError;
133
+ for (arguments.length > 2 && (r = n), i = 0; i < u; ) {
134
+ var s;
135
+ if (i in o) {
136
+ s = o[i];
137
+ var l = t.call(r, s, i, o);
138
+ if (!l) return !1;
139
+ }
140
+ i++;
141
+ }
142
+ return !0;
143
+ }, reduce = function(e, t) {
144
+ if (null === e) throw new TypeError("Array.prototype.reduce called on null or undefined");
145
+ if ("function" != typeof t) throw new TypeError(t + " is not a function");
146
+ var n, r = Object(e), i = r.length >>> 0, o = 0;
147
+ if (arguments.length >= 3) n = arguments[2]; else {
148
+ for (;o < i && !(o in r); ) o++;
149
+ if (o >= i) throw new TypeError("Reduce of empty array with no initial value");
150
+ n = r[o++];
151
+ }
152
+ for (;o < i; ) o in r && (n = t(n, r[o], o, r)), o++;
153
+ return n;
154
+ }, parse2string = function(e) {
155
+ return isEmpty(e) ? "" : JSON.stringify(e);
156
+ }, parse2object = function(e) {
157
+ return isEmpty(e) ? null : JSON.parse(e);
158
+ }, dataToArray = function(e) {
159
+ return isArray(e) ? e : [ e ];
160
+ };
218
161
 
219
162
  function clone(e) {
220
163
  if (null == e || "object" != (0, _typeof2.default)(e)) return e;
221
- var t = e,
222
- n = toString.call(e);
223
- if ("[object Array]" === n)
224
- for (var t = [], r = 0, i = e.length; r < i; r++) t[r] = clone(e[r]);
225
- else if (TYPED_ARRAY[n]) {
164
+ var t = e, n = toString.call(e);
165
+ if ("[object Array]" === n) {
166
+ t = [];
167
+ for (var r = 0, i = e.length; r < i; r++) t[r] = clone(e[r]);
168
+ } else if (TYPED_ARRAY[n]) {
226
169
  var o = e.constructor;
227
- if (e.constructor.from) t = o.from(e);
228
- else {
170
+ if (e.constructor.from) t = o.from(e); else {
229
171
  t = new o(e.length);
230
- for (var u = 0, s = e.length; u < s; u++) t[u] = clone(e[u])
172
+ for (var u = 0, s = e.length; u < s; u++) t[u] = clone(e[u]);
231
173
  }
232
- } else if (!BUILTIN_OBJECT[n] && !isDom(e))
233
- for (var l in t = {}, e) e.hasOwnProperty(l) && (t[l] = clone(e[l]));
234
- return t
174
+ } else if (!BUILTIN_OBJECT[n] && !isDom(e)) for (var l in t = {}, e) e.hasOwnProperty(l) && (t[l] = clone(e[l]));
175
+ return t;
235
176
  }
236
177
 
237
178
  function merge(e, t, n) {
238
179
  if (!isObject(t) || !isObject(e)) return n ? clone(t) : e;
239
- for (var r in t) {
240
- var i, o;
241
- t.hasOwnProperty(r) && (i = e[r], o = t[r], !isObject(o) || !isObject(i) || isArray(o) || isArray(i) || isDom(o) || isDom(i) || isBuiltInObject(o) || isBuiltInObject(i) ? !n && r in e || (e[r] = clone(t[r])) : merge(i, o, n))
180
+ for (var r in t) if (t.hasOwnProperty(r)) {
181
+ var i = e[r], o = t[r];
182
+ !isObject(o) || !isObject(i) || isArray(o) || isArray(i) || isDom(o) || isDom(i) || isBuiltInObject(o) || isBuiltInObject(i) ? !n && r in e || (e[r] = clone(t[r])) : merge(i, o, n);
242
183
  }
243
- return e
184
+ return e;
244
185
  }
245
186
 
246
187
  function mergeAll(e, t) {
247
188
  for (var n = e[0], r = 1, i = e.length; r < i; r++) n = merge(n, e[r], t);
248
- return n
189
+ return n;
249
190
  }
191
+
192
+ function subObjectEqual(e, t) {
193
+ return !(!isEmpty(e) && !isEmpty(t)) || (e === t || !Object.keys(t).some((function(n) {
194
+ return n in e && t[n] !== e[n];
195
+ })));
196
+ }
197
+
250
198
  module.exports = {
251
199
  isString: isString,
252
200
  isArray: isArray,
@@ -288,5 +236,6 @@ module.exports = {
288
236
  dataToArray: dataToArray,
289
237
  clone: clone,
290
238
  merge: merge,
291
- mergeAll: mergeAll
292
- };
239
+ mergeAll: mergeAll,
240
+ subObjectEqual: subObjectEqual
241
+ };
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+
2
3
  module.exports = function(e) {
3
- return null == e || 0 == e.length ? "" : e.replace(/&/g, "&gt;").replace(/</g, "&lt").replace(/>/, "&gt").replace(/\s/g, "&nbsp;").replace(/\'/g, "&#39;").replace(/\"/g, "&quot;").replace(/(\r\n|\r|\n)/g, "<br/>")
4
- };
4
+ return null == e || 0 == e.length ? "" : e.replace(/&/g, "&gt;").replace(/</g, "&lt").replace(/>/, "&gt").replace(/\s/g, "&nbsp;").replace(/\'/g, "&#39;").replace(/\"/g, "&quot;").replace(/(\r\n|\r|\n)/g, "<br/>");
5
+ };
@@ -1,40 +1,39 @@
1
1
  "use strict";
2
+
2
3
  var attributes = {
3
- CASE_INSENSITIVE: "i",
4
- MULTILINE: "",
5
- DOTALL: ""
6
- },
7
- events = ["oncontrolselect", "oncopy", "oncut", "ondataavailable", "ondatasetchanged", "ondatasetcomplete", "ondblclick", "ondeactivate", "ondrag", "ondragend", "ondragenter", "ondragleave", "ondragover", "ondragstart", "ondrop", "onerror=", "onerroupdate", "onfilterchange", "onfinish", "onfocus", "onfocusin", "onfocusout", "onhelp", "onkeydown", "onkeypress", "onkeyup", "onlayoutcomplete", "onload", "onlosecapture", "onmousedown", "onmouseenter", "onmouseleave", "onmousemove", "onmousout", "onmouseover", "onmouseup", "onmousewheel", "onmove", "onmoveend", "onmovestart", "onabort", "onactivate", "onafterprint", "onafterupdate", "onbefore", "onbeforeactivate", "onbeforecopy", "onbeforecut", "onbeforedeactivate", "onbeforeeditocus", "onbeforepaste", "onbeforeprint", "onbeforeunload", "onbeforeupdate", "onblur", "onbounce", "oncellchange", "onchange", "onclick", "oncontextmenu", "onpaste", "onpropertychange", "onreadystatechange", "onreset", "onresize", "onresizend", "onresizestart", "onrowenter", "onrowexit", "onrowsdelete", "onrowsinserted", "onscroll", "onselect", "onselectionchange", "onselectstart", "onstart", "onstop", "onsubmit", "onunload"],
8
- eventStr = "<+\\s*\\w*\\s*(oncontrolselect|oncopy|oncut|ondataavailable|ondatasetchanged|ondatasetcomplete|ondblclick|ondeactivate|ondrag|ondragend|ondragenter|ondragleave|ondragover|ondragstart|ondrop|onerror=|onerroupdate|onfilterchange|onfinish|onfocus|onfocusin|onfocusout|onhelp|onkeydown|onkeypress|onkeyup|onlayoutcomplete|onload|onlosecapture|onmousedown|onmouseenter|onmouseleave|onmousemove|onmousout|onmouseover|onmouseup|onmousewheel|onmove|onmoveend|onmovestart|onabort|onactivate|onafterprint|onafterupdate|onbefore|onbeforeactivate|onbeforecopy|onbeforecut|onbeforedeactivate|onbeforeeditocus|onbeforepaste|onbeforeprint|onbeforeunload|onbeforeupdate|onblur|onbounce|oncellchange|onchange|onclick|oncontextmenu|onpaste|onpropertychange|onreadystatechange|onreset|onresize|onresizend|onresizestart|onrowenter|onrowexit|onrowsdelete|onrowsinserted|onscroll|onselect|onselectionchange|onselectstart|onstart|onstop|onsubmit|onunload)+\\s*=+",
9
- getXssPatternList = function() {
10
- var o = [];
11
- return o.push({
12
- pattern: "<(no)?script[^>]*>.*?</(no)?script>",
13
- flags: [attributes.CASE_INSENSITIVE]
14
- }), o.push({
15
- pattern: "eval\\((.*?)\\)",
16
- flags: [attributes.CASE_INSENSITIVE, attributes.MULTILINE, attributes.DOTALL]
17
- }), o.push({
18
- pattern: "expression\\((.*?)\\)",
19
- flags: [attributes.CASE_INSENSITIVE, attributes.MULTILINE, attributes.DOTALL]
20
- }), o.push({
21
- pattern: "(javascript:|vbscript:|view-source:)*",
22
- flags: [attributes.CASE_INSENSITIVE]
23
- }), o.push({
24
- pattern: "<(\"[^\"]*\"|'[^']*'|[^'\">])*>",
25
- flags: [attributes.CASE_INSENSITIVE, attributes.MULTILINE, attributes.DOTALL]
26
- }), o.push({
27
- pattern: "(window\\.location|window\\.|\\.location|document\\.cookie|document\\.|alert\\(.*?\\)|window\\.open\\()*",
28
- flags: [attributes.CASE_INSENSITIVE, attributes.MULTILINE, attributes.DOTALL]
29
- }), o.push({
30
- pattern: eventStr,
31
- flags: [attributes.CASE_INSENSITIVE, attributes.MULTILINE, attributes.DOTALL]
32
- }), o
33
- };
34
- module.exports = function(e) {
35
- var n = [];
36
- return getXssPatternList().forEach(function(o) {
37
- o = new RegExp(o.pattern, o.flags.join(""));
38
- n.push(o), e = e.replace(o, "")
39
- }), e
4
+ CASE_INSENSITIVE: "i",
5
+ MULTILINE: "",
6
+ DOTALL: ""
7
+ }, events = [ "oncontrolselect", "oncopy", "oncut", "ondataavailable", "ondatasetchanged", "ondatasetcomplete", "ondblclick", "ondeactivate", "ondrag", "ondragend", "ondragenter", "ondragleave", "ondragover", "ondragstart", "ondrop", "onerror=", "onerroupdate", "onfilterchange", "onfinish", "onfocus", "onfocusin", "onfocusout", "onhelp", "onkeydown", "onkeypress", "onkeyup", "onlayoutcomplete", "onload", "onlosecapture", "onmousedown", "onmouseenter", "onmouseleave", "onmousemove", "onmousout", "onmouseover", "onmouseup", "onmousewheel", "onmove", "onmoveend", "onmovestart", "onabort", "onactivate", "onafterprint", "onafterupdate", "onbefore", "onbeforeactivate", "onbeforecopy", "onbeforecut", "onbeforedeactivate", "onbeforeeditocus", "onbeforepaste", "onbeforeprint", "onbeforeunload", "onbeforeupdate", "onblur", "onbounce", "oncellchange", "onchange", "onclick", "oncontextmenu", "onpaste", "onpropertychange", "onreadystatechange", "onreset", "onresize", "onresizend", "onresizestart", "onrowenter", "onrowexit", "onrowsdelete", "onrowsinserted", "onscroll", "onselect", "onselectionchange", "onselectstart", "onstart", "onstop", "onsubmit", "onunload" ], eventStr = "<+\\s*\\w*\\s*(oncontrolselect|oncopy|oncut|ondataavailable|ondatasetchanged|ondatasetcomplete|ondblclick|ondeactivate|ondrag|ondragend|ondragenter|ondragleave|ondragover|ondragstart|ondrop|onerror=|onerroupdate|onfilterchange|onfinish|onfocus|onfocusin|onfocusout|onhelp|onkeydown|onkeypress|onkeyup|onlayoutcomplete|onload|onlosecapture|onmousedown|onmouseenter|onmouseleave|onmousemove|onmousout|onmouseover|onmouseup|onmousewheel|onmove|onmoveend|onmovestart|onabort|onactivate|onafterprint|onafterupdate|onbefore|onbeforeactivate|onbeforecopy|onbeforecut|onbeforedeactivate|onbeforeeditocus|onbeforepaste|onbeforeprint|onbeforeunload|onbeforeupdate|onblur|onbounce|oncellchange|onchange|onclick|oncontextmenu|onpaste|onpropertychange|onreadystatechange|onreset|onresize|onresizend|onresizestart|onrowenter|onrowexit|onrowsdelete|onrowsinserted|onscroll|onselect|onselectionchange|onselectstart|onstart|onstop|onsubmit|onunload)+\\s*=+", getXssPatternList = function() {
8
+ var o = [];
9
+ return o.push({
10
+ pattern: "<(no)?script[^>]*>.*?</(no)?script>",
11
+ flags: [ attributes.CASE_INSENSITIVE ]
12
+ }), o.push({
13
+ pattern: "eval\\((.*?)\\)",
14
+ flags: [ attributes.CASE_INSENSITIVE, attributes.MULTILINE, attributes.DOTALL ]
15
+ }), o.push({
16
+ pattern: "expression\\((.*?)\\)",
17
+ flags: [ attributes.CASE_INSENSITIVE, attributes.MULTILINE, attributes.DOTALL ]
18
+ }), o.push({
19
+ pattern: "(javascript:|vbscript:|view-source:)*",
20
+ flags: [ attributes.CASE_INSENSITIVE ]
21
+ }), o.push({
22
+ pattern: "<(\"[^\"]*\"|'[^']*'|[^'\">])*>",
23
+ flags: [ attributes.CASE_INSENSITIVE, attributes.MULTILINE, attributes.DOTALL ]
24
+ }), o.push({
25
+ pattern: "(window\\.location|window\\.|\\.location|document\\.cookie|document\\.|alert\\(.*?\\)|window\\.open\\()*",
26
+ flags: [ attributes.CASE_INSENSITIVE, attributes.MULTILINE, attributes.DOTALL ]
27
+ }), o.push({
28
+ pattern: eventStr,
29
+ flags: [ attributes.CASE_INSENSITIVE, attributes.MULTILINE, attributes.DOTALL ]
30
+ }), o;
40
31
  };
32
+
33
+ module.exports = function(o) {
34
+ var e = [];
35
+ return getXssPatternList().forEach((function(n) {
36
+ var t = new RegExp(n.pattern, n.flags.join(""));
37
+ e.push(t), o = o.replace(t, "");
38
+ })), o;
39
+ };
package/lib/xss/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
- var htmlEncode = require("./htmlEncode"),
3
- implementEncode = require("./implementEncode");
2
+
3
+ var htmlEncode = require("./htmlEncode"), implementEncode = require("./implementEncode");
4
+
4
5
  module.exports = {
5
6
  htmlEncode: htmlEncode,
6
7
  implementEncode: implementEncode
7
- };
8
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amos-tool",
3
- "version": "1.4.7",
3
+ "version": "1.4.8",
4
4
  "description": "amos ui tool",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -31,16 +31,16 @@
31
31
  },
32
32
  "types": "index.d.ts",
33
33
  "homepage": "",
34
- "dependencies": {},
34
+ "dependencies": {
35
+ },
35
36
  "devDependencies": {
36
37
  "assert": "^1.4.1",
37
38
  "chai": "~3.4.1",
38
39
  "docdash": "1.2.0",
39
- "eslint-config-ray": "^2.x",
40
40
  "jsdoc": "3.6.6",
41
41
  "mocha": "^3.4.2",
42
42
  "mochawesome": "^2.2.0",
43
- "rollup-toolkit": "^1.0.0"
43
+ "rollup-toolkit": "^1.x"
44
44
  },
45
45
  "publishConfig": {
46
46
  "registry": "https://registry.npmjs.org/"