amos-tool 1.4.9 → 1.4.12

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 (35) hide show
  1. package/docs/Logger.html +347 -0
  2. package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  3. package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  4. package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  5. package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  6. package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  7. package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  8. package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  9. package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  10. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  11. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
  12. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  13. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  14. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  15. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  16. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
  17. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  18. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  19. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  20. package/docs/global.html +15490 -0
  21. package/docs/index.html +794 -0
  22. package/docs/scripts/collapse.js +20 -0
  23. package/docs/scripts/linenumber.js +25 -0
  24. package/docs/scripts/nav.js +12 -0
  25. package/docs/scripts/polyfill.js +4 -0
  26. package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
  27. package/docs/scripts/prettify/lang-css.js +2 -0
  28. package/docs/scripts/prettify/prettify.js +28 -0
  29. package/docs/scripts/search.js +83 -0
  30. package/docs/styles/jsdoc.css +765 -0
  31. package/docs/styles/prettify.css +79 -0
  32. package/index.d.ts +40 -0
  33. package/lib/completeUnit.js +3 -4
  34. package/lib/utils.js +20 -0
  35. package/package.json +1 -1
@@ -0,0 +1,794 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+
5
+ <meta charset="utf-8">
6
+ <title>Home - Documentation</title>
7
+
8
+
9
+ <script src="scripts/prettify/prettify.js"></script>
10
+ <script src="scripts/prettify/lang-css.js"></script>
11
+ <!--[if lt IE 9]>
12
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
13
+ <![endif]-->
14
+ <link type="text/css" rel="stylesheet" href="styles/prettify.css">
15
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
16
+ <script src="scripts/nav.js" defer></script>
17
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
18
+ </head>
19
+ <body>
20
+
21
+ <input type="checkbox" id="nav-trigger" class="nav-trigger" />
22
+ <label for="nav-trigger" class="navicon-button x">
23
+ <div class="navicon"></div>
24
+ </label>
25
+
26
+ <label for="nav-trigger" class="overlay"></label>
27
+
28
+ <nav >
29
+
30
+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Logger.html">Logger</a><ul class='methods'><li data-type='method'><a href="Logger.html#pkgInfo">pkgInfo</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#_boost">_boost</a></li><li><a href="global.html#_defaultBrowsers">_defaultBrowsers</a></li><li><a href="global.html#_muiltBrowsers">_muiltBrowsers</a></li><li><a href="global.html#_utils">_utils</a></li><li><a href="global.html#advancePolicy">advancePolicy</a></li><li><a href="global.html#amosCookie">amosCookie</a></li><li><a href="global.html#array2tree">array2tree</a></li><li><a href="global.html#arrayFilter">arrayFilter</a></li><li><a href="global.html#beautifyRoutes">beautifyRoutes</a></li><li><a href="global.html#browserSupport">browserSupport</a></li><li><a href="global.html#bt4ToHex">bt4ToHex</a></li><li><a href="global.html#byteToString">byteToString</a></li><li><a href="global.html#calcBrowserVersion">calcBrowserVersion</a></li><li><a href="global.html#checkFlash">checkFlash</a></li><li><a href="global.html#clone">clone</a></li><li><a href="global.html#colorKeyWordsHexStr">colorKeyWordsHexStr</a></li><li><a href="global.html#completeUnit">completeUnit</a></li><li><a href="global.html#customEqual">customEqual</a></li><li><a href="global.html#debounce">debounce</a></li><li><a href="global.html#deepCopy">deepCopy</a></li><li><a href="global.html#deepEqual">deepEqual</a></li><li><a href="global.html#DesUtils">DesUtils</a></li><li><a href="global.html#divide">divide</a></li><li><a href="global.html#drawPolygon">drawPolygon</a></li><li><a href="global.html#enc">enc</a></li><li><a href="global.html#encodeLen">encodeLen</a></li><li><a href="global.html#encodeNumber">encodeNumber</a></li><li><a href="global.html#eq">eq</a></li><li><a href="global.html#fieldContentRegExp">fieldContentRegExp</a></li><li><a href="global.html#fileSizeToByte">fileSizeToByte</a></li><li><a href="global.html#fileterAllMatchedData">fileterAllMatchedData</a></li><li><a href="global.html#filterAllCheckedData">filterAllCheckedData</a></li><li><a href="global.html#filterChilds">filterChilds</a></li><li><a href="global.html#filterTreeLevel">filterTreeLevel</a></li><li><a href="global.html#genBitmapImage">genBitmapImage</a></li><li><a href="global.html#generateKeys">generateKeys</a></li><li><a href="global.html#getFileExtension">getFileExtension</a></li><li><a href="global.html#getKeyBytes">getKeyBytes</a></li><li><a href="global.html#getTreeFlatKeys">getTreeFlatKeys</a></li><li><a href="global.html#gradientColor">gradientColor</a></li><li><a href="global.html#has">has</a></li><li><a href="global.html#hasOwnProperty">hasOwnProperty</a></li><li><a href="global.html#hexToBt4">hexToBt4</a></li><li><a href="global.html#imageCompress">imageCompress</a></li><li><a href="global.html#isArray">isArray</a></li><li><a href="global.html#isBoolean">isBoolean</a></li><li><a href="global.html#isBuiltInObject">isBuiltInObject</a></li><li><a href="global.html#isDom">isDom</a></li><li><a href="global.html#isElement">isElement</a></li><li><a href="global.html#isEmpty">isEmpty</a></li><li><a href="global.html#isEmptyObject">isEmptyObject</a></li><li><a href="global.html#isFloat">isFloat</a></li><li><a href="global.html#isHexColor">isHexColor</a></li><li><a href="global.html#isImageSrc">isImageSrc</a></li><li><a href="global.html#isInputEqual">isInputEqual</a></li><li><a href="global.html#isJson">isJson</a></li><li><a href="global.html#isKeyColor">isKeyColor</a></li><li><a href="global.html#isKeyInObject">isKeyInObject</a></li><li><a href="global.html#isNil">isNil</a></li><li><a href="global.html#isNull">isNull</a></li><li><a href="global.html#isNumber">isNumber</a></li><li><a href="global.html#isObject">isObject</a></li><li><a href="global.html#isOnlyObject">isOnlyObject</a></li><li><a href="global.html#isOpacity">isOpacity</a></li><li><a href="global.html#isOwnKeyInObject">isOwnKeyInObject</a></li><li><a href="global.html#isRgbColor">isRgbColor</a></li><li><a href="global.html#isUndefined">isUndefined</a></li><li><a href="global.html#isUrl">isUrl</a></li><li><a href="global.html#isValidDate">isValidDate</a></li><li><a href="global.html#keyColorToHex">keyColorToHex</a></li><li><a href="global.html#Log">Log</a></li><li><a href="global.html#merge">merge</a></li><li><a href="global.html#mergeAll">mergeAll</a></li><li><a href="global.html#mod">mod</a></li><li><a href="global.html#multiply">multiply</a></li><li><a href="global.html#normalPolicy">normalPolicy</a></li><li><a href="global.html#null2default">null2default</a></li><li><a href="global.html#objRGB2str">objRGB2str</a></li><li><a href="global.html#parse">parse</a></li><li><a href="global.html#pathToTree">pathToTree</a></li><li><a href="global.html#plus">plus</a></li><li><a href="global.html#PNGlib">PNGlib</a></li><li><a href="global.html#Queue">Queue</a></li><li><a href="global.html#random">random</a></li><li><a href="global.html#randomInt">randomInt</a></li><li><a href="global.html#recursive">recursive</a></li><li><a href="global.html#recursiveGen">recursiveGen</a></li><li><a href="global.html#rgb2object">rgb2object</a></li><li><a href="global.html#saveAsImage">saveAsImage</a></li><li><a href="global.html#serialize">serialize</a></li><li><a href="global.html#shallowEqual">shallowEqual</a></li><li><a href="global.html#simpleEqual">simpleEqual</a></li><li><a href="global.html#simpleThrottle">simpleThrottle</a></li><li><a href="global.html#some">some</a></li><li><a href="global.html#stringIsJson">stringIsJson</a></li><li><a href="global.html#strToBt">strToBt</a></li><li><a href="global.html#subObjectEqual">subObjectEqual</a></li><li><a href="global.html#subtract">subtract</a></li><li><a href="global.html#throttle">throttle</a></li><li><a href="global.html#toHexColor">toHexColor</a></li><li><a href="global.html#toRGBcolor">toRGBcolor</a></li><li><a href="global.html#toStringHexColor">toStringHexColor</a></li><li><a href="global.html#transformColor">transformColor</a></li><li><a href="global.html#useMd5Policy">useMd5Policy</a></li><li><a href="global.html#useMd5Policy2">useMd5Policy2</a></li><li><a href="global.html#utils">utils</a></li><li><a href="global.html#values">values</a></li></ul>
31
+ </nav>
32
+
33
+ <div id="main">
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+ <section class="package">
44
+ <h3> </h3>
45
+ </section>
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+ <section class="readme usertext">
60
+ <article><h1>amos-tool</h1>
61
+ <p>by ilex.h</p>
62
+ <p>docs: <a href="https://unpkg.com/amos-tool@latest/docs/index.html">docs</a></p>
63
+ <h2>useage</h2>
64
+ <p>npm install --save amos-tool</p>
65
+ <h2>keywords</h2>
66
+ <ul>
67
+ <li>amos ui</li>
68
+ <li>amos tool</li>
69
+ </ul>
70
+ <h2>infos</h2>
71
+ <p><a href="https://packagephobia.now.sh/result?p=amos-tool"><img src="https://packagephobia.now.sh/badge?p=amos-tool" alt="install size"></a></p>
72
+ <h2>api</h2>
73
+ <table>
74
+ <thead>
75
+ <tr>
76
+ <th>name</th>
77
+ <th>link</th>
78
+ <th>description</th>
79
+ </tr>
80
+ </thead>
81
+ <tbody>
82
+ <tr>
83
+ <td>Base64</td>
84
+ <td><a href="#base64">Base64</a></td>
85
+ <td><code>base64加密解密</code></td>
86
+ </tr>
87
+ <tr>
88
+ <td>MD5</td>
89
+ <td><a href="#md5">MD5</a></td>
90
+ <td><code>md5加密解密</code></td>
91
+ </tr>
92
+ <tr>
93
+ <td>DES</td>
94
+ <td><a href="#des">DES</a></td>
95
+ <td><code>des加密解密</code></td>
96
+ </tr>
97
+ <tr>
98
+ <td>Browser</td>
99
+ <td><a href="#browser">Browser</a></td>
100
+ <td><code>获取浏览器类型</code></td>
101
+ </tr>
102
+ <tr>
103
+ <td>deepCopy</td>
104
+ <td><a href="#deepCopy">deepCopy</a></td>
105
+ <td><code>深度复制</code></td>
106
+ </tr>
107
+ <tr>
108
+ <td>deepEqual</td>
109
+ <td><a href="#deepEqual">deepEqual</a></td>
110
+ <td><code>深度比较(stringify方式)</code></td>
111
+ </tr>
112
+ <tr>
113
+ <td>fastDeepEqual</td>
114
+ <td><a href="#fastDeepEqual">fastDeepEqual</a></td>
115
+ <td><code>深度比较(循环)</code></td>
116
+ </tr>
117
+ <tr>
118
+ <td>parseText</td>
119
+ <td><a href="#parseText">parseText</a></td>
120
+ <td><code>替换或者补全url</code></td>
121
+ </tr>
122
+ <tr>
123
+ <td>List</td>
124
+ <td><a href="#list">List</a></td>
125
+ <td><code>List集合</code></td>
126
+ </tr>
127
+ <tr>
128
+ <td>Queue</td>
129
+ <td><a href="#queue">Queue</a></td>
130
+ <td><code>队列</code></td>
131
+ </tr>
132
+ <tr>
133
+ <td>UUID</td>
134
+ <td><a href="#uuid">UUID</a></td>
135
+ <td><code>uuid</code></td>
136
+ </tr>
137
+ <tr>
138
+ <td>browserSupport</td>
139
+ <td><a href="#browserSupport">browserSupport</a></td>
140
+ <td><code>浏览器支持</code></td>
141
+ </tr>
142
+ <tr>
143
+ <td>Log</td>
144
+ <td><a href="#log">Log</a></td>
145
+ <td><code>定制化的log日志</code></td>
146
+ </tr>
147
+ <tr>
148
+ <td>Store</td>
149
+ <td><a href="#store">Store</a></td>
150
+ <td><code>数据处理,主要是localStorage、session、cookie</code></td>
151
+ </tr>
152
+ <tr>
153
+ <td>LocationParam</td>
154
+ <td><a href="#locationParam">LocationParam</a></td>
155
+ <td><code>location 工具</code></td>
156
+ </tr>
157
+ <tr>
158
+ <td>array2tree</td>
159
+ <td><a href="#array2tree">array2tree</a></td>
160
+ <td><code>将array转化为tree数据</code></td>
161
+ </tr>
162
+ <tr>
163
+ <td>tableFilter</td>
164
+ <td><a href="#tableFilter">tableFilter</a></td>
165
+ <td><code>表格数据过滤</code></td>
166
+ </tr>
167
+ <tr>
168
+ <td>pwdPolicy</td>
169
+ <td><a href="#pwdPolicy">pwdPolicy</a></td>
170
+ <td><code>密码生成器</code></td>
171
+ </tr>
172
+ <tr>
173
+ <td>omit</td>
174
+ <td><a href="#omit">omit</a></td>
175
+ <td><code>omit操作,删除object中的键</code></td>
176
+ </tr>
177
+ <tr>
178
+ <td>pick</td>
179
+ <td><a href="#pick">pick</a></td>
180
+ <td><code>pick操作,获取object指定key组成的新对象</code></td>
181
+ </tr>
182
+ <tr>
183
+ <td>utils</td>
184
+ <td><a href="#utils">utils</a></td>
185
+ <td><code>常用工具</code></td>
186
+ </tr>
187
+ <tr>
188
+ <td>xss</td>
189
+ <td><a href="#xss">utils</a></td>
190
+ <td><code>xss 工具及</code></td>
191
+ </tr>
192
+ <tr>
193
+ <td>strUtils</td>
194
+ <td><a href="#strUtils">strUtils</a></td>
195
+ <td><code>string常用工具</code></td>
196
+ </tr>
197
+ <tr>
198
+ <td>other</td>
199
+ <td><a href="#other">other</a></td>
200
+ <td><code>其它工具集</code></td>
201
+ </tr>
202
+ </tbody>
203
+ </table>
204
+ <h3>base64</h3>
205
+ <pre class="prettyprint source lang-js"><code>import { Base64 } from 'amos-tool';
206
+ // or import Base64 from 'amos-tool/lib/encrypt/_base64';
207
+
208
+ var b64 = new Base64();
209
+
210
+ b64.encode(input);
211
+ b64.decode(input);
212
+ </code></pre>
213
+ <h3>md5</h3>
214
+ <pre class="prettyprint source lang-js"><code>import { MD5 } from 'amos-tool';
215
+ // or import MD5 from 'amos-tool/lib/encrypt/_md5';
216
+
217
+ var result = MD5('value'); // 2063c1608d6e0baf80249c42e2be5804
218
+ var result = MD5('value', 'key'); // 01433efd5f16327ea4b31144572c67f6
219
+ var result = MD5('value', null, true); // 'c\xc1`\x8dn\x0b\xaf\x80$\x9cB\xe2\xbeX\x04'
220
+ var result = MD5('value', 'key', true); // '\x01C>\xfd_\x162~\xa4\xb3\x11DW,g\xf6'
221
+ </code></pre>
222
+ <h3>des</h3>
223
+ <blockquote>
224
+ <p>注意,加密解密时,第一个 <code>秘钥</code> 不能为空</p>
225
+ </blockquote>
226
+ <pre class="prettyprint source lang-js"><code>DES.DesCore.encode(data, firstKey, secondKey, thirdKey)
227
+ DES.DesCore.decode(data, firstKey, secondKey, thirdKey)
228
+
229
+ DES.encode(data, secretKey);
230
+ DES.decode(data, secretKey);
231
+ </code></pre>
232
+ <ul>
233
+ <li>example</li>
234
+ </ul>
235
+ <pre class="prettyprint source lang-js"><code>import { DES } from 'amos-tool';
236
+ // or import DES from 'amos-tool/lib/encrypt/des';
237
+
238
+ const desCore = DES.DesCore;
239
+
240
+ desCore.encode('123456', 'a'); // 484FD6D18A5501370873DB5F557A23F9
241
+ desCore.encode('123456', 'a', 'b'); // 953AFFF48E49E4B94D8B74AABB6905E5
242
+ desCore.encode('123456', 'a', 'b', 'c'); // 7C49B05CCBCBEECC5665732A177E624B
243
+
244
+ desCore.decode('484FD6D18A5501370873DB5F557A23F9', 'a'); // 123456
245
+ desCore.decode('953AFFF48E49E4B94D8B74AABB6905E5', 'a', 'b'); // 123456
246
+ desCore.decode('7C49B05CCBCBEECC5665732A177E624B', 'a', 'b', 'c'); // 123456
247
+
248
+
249
+ DES.encode('123456', 'a'); // 484FD6D18A5501370873DB5F557A23F9
250
+ DES.encode('123456', 'a,b'); // 953AFFF48E49E4B94D8B74AABB6905E5
251
+ DES.encode('123456', 'a,b,c'); // 7C49B05CCBCBEECC5665732A177E624B
252
+
253
+ DES.decode('484FD6D18A5501370873DB5F557A23F9', 'a'); // 123456
254
+ DES.decode('953AFFF48E49E4B94D8B74AABB6905E5', 'a,b'); // 123456
255
+ DES.decode('7C49B05CCBCBEECC5665732A177E624B', 'a,b,c'); // 123456
256
+ </code></pre>
257
+ <blockquote>
258
+ <p>注意:</p>
259
+ </blockquote>
260
+ <p>secretKey 'a,b,c' 与 <code>a, b,c</code> 不同,识别空格。 支持3个秘钥,采用 <code>,</code> 分割</p>
261
+ <p>同时,<code>DES.DesCore</code> 第一个 key 值不可以为 空('', undefined, null)</p>
262
+ <h3>browser</h3>
263
+ <pre class="prettyprint source lang-js"><code> Browser.isFirefox();
264
+ Browser.isIE();
265
+ Browser.isEdge();
266
+ Browser.isChrome();
267
+ Browser.isSafari();
268
+ </code></pre>
269
+ <h3>deepCopy</h3>
270
+ <pre class="prettyprint source lang-js"><code>import { deepCopy } from 'amos-tool';
271
+
272
+ deepCopy(source);
273
+
274
+ import deepCopy, { eq } from 'amos-tool/lib/_deepCopy';
275
+
276
+ eq(value, other)
277
+ </code></pre>
278
+ <h3>deepEqual</h3>
279
+ <pre class="prettyprint source lang-js"><code>deepEqual(valA, valB);
280
+ </code></pre>
281
+ <h3>fastDeepEqual</h3>
282
+ <pre class="prettyprint source lang-js"><code>fastDeepEqual(valA, valB);
283
+ </code></pre>
284
+ <h3>parseText</h3>
285
+ <pre class="prettyprint source lang-js"><code>
286
+ /**
287
+ * 解析数据
288
+ * @param {string} text
289
+ * @param {object} dataObj
290
+ * @param {string|RegExp} regexps 可选
291
+ * @doc parseText('a/{b}/{c}/d',{a: 1, b:2}) 返回: 'a/1/2/d'
292
+ * @doc parseText('a/b?name={name}&pwd={pwd}',{name: 'ilex', pwd:122}) 返回: 'a/b?name=ilex&pwd=123'
293
+ */
294
+ parseText(text, dataObj, regexps);
295
+ </code></pre>
296
+ <h3>list</h3>
297
+ <pre class="prettyprint source lang-js"><code> List props:
298
+
299
+ ArrayList: var arrlist = new List.ArrayList();
300
+ parse2string: List.parse2string(obj)
301
+ parse2object: List.parse2object(str)
302
+ simpleEqual: List.simpleEqual(objA, objB)
303
+ isObject: List.isObject(obj)
304
+
305
+ // ArrayList
306
+ var arrlist = new List.ArrayList();
307
+
308
+ arrlist.size(); // get size of list
309
+ arrlist.values();// all values
310
+ arrlist.isEmpty();// check empty
311
+ arrlist.iterator(callBack);// iterator
312
+ arrlist.get(index);// 取得指定下标的值
313
+ arrlist.add(value); // add item
314
+ arrlist.addAll(value);// add all item, value is a arrayList
315
+ arrlist.set(index, value);// 设置值
316
+ arrlist.remove(value);// remove item
317
+ arrlist.removeAt(index); // //remove item by index
318
+ arrlist.indexOf(value); // get item index from list
319
+ arrlist.clear(); // clear list
320
+ arrlist.insert(index, value); // insert item in index place
321
+ arrlist.updateValue(key, value); // use value[key] check equal
322
+ </code></pre>
323
+ <h3>queue</h3>
324
+ <pre class="prettyprint source lang-js"><code> var q = new Queue;
325
+ q.push(obj) // 入队
326
+ q.pop();// 出队
327
+ q.head();// 返回队列中头部(即最新添加的)的动态对象
328
+ q.tail();// 返回队列中尾部(即最早添加的)的动态对象
329
+ q.length();// 返回数据队列长度
330
+ q.empty(); // 队列是否为空
331
+ q.clear(); // 清空
332
+ </code></pre>
333
+ <h3>uuid</h3>
334
+ <pre class="prettyprint source lang-js"><code> uuid(len, radix); // radix must be &lt;= 62 , uuid(8, 2)
335
+ uuidFast();
336
+ uuidCompact();
337
+ timeUUID(prefix = 'amos-timeuuid');
338
+ longTimeUUID(prefix = 'longtime');
339
+ otherUUID(tpl = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'); // 同 uuidCompact,无 '-'
340
+ </code></pre>
341
+ <h3>browserSupport</h3>
342
+ <ul>
343
+ <li>apis</li>
344
+ </ul>
345
+ <pre class="prettyprint source lang-js"><code> simpleuse:
346
+ defaultConfig: ['firefox/51.0', 'chrome/56']
347
+ browserSupport();
348
+ browserSupport('firefox/51.0');
349
+ browserSupport(['firefox/51.0', 'chrome/56']);
350
+ withMatchs:
351
+ muitlConfig: ['firefox/', 'chrome/'];
352
+ browserSupport(null, {
353
+ 'firefox/': {limit: consts.GREATER_EQUAL, version: 51},
354
+ 'chrome/': {limit: consts.GREATER_EQUAL, version: 56}
355
+ });
356
+
357
+ browserSupport('firefox/', {limit: consts.GREATER_EQUAL, version: 51});
358
+
359
+ browserSupport(['firefox/', 'chrome/'], {
360
+ 'firefox/': {limit: consts.GREATER_EQUAL, version: 51},
361
+ 'chrome/': {limit: consts.GREATER_EQUAL, version: 56}
362
+ });
363
+
364
+ consts:
365
+ GREATER: 1, // 大于
366
+ EQUAL: 2, // 等于
367
+ LESS: 3, // 小于
368
+ GREATER_EQUAL: 4, // 大于等于
369
+ LESS_EQUAL: 5 // 小于等于
370
+ </code></pre>
371
+ <ul>
372
+ <li>demo</li>
373
+ </ul>
374
+ <pre class="prettyprint source lang-js"><code>// 基本使用
375
+ const result = browserSupport();
376
+
377
+ const paramsList = ['firefox/', 'chrome/', 'ie'];
378
+ const limit = {
379
+ 'firefox/': { limit: consts.GREATER_EQUAL, version: 50 },
380
+ 'chrome/': { limit: consts.GREATER_EQUAL, version: 55 },
381
+ 'ie': { limit: consts.GREATER_EQUAL, version: 6 }
382
+ };
383
+
384
+ // 自定义使用 (注意适配ie时 写法)
385
+ const result2 = browserSupport(paramsList, limit);
386
+ </code></pre>
387
+ <h3>log</h3>
388
+ <pre class="prettyprint source lang-js"><code>
389
+ window.LogConfig
390
+ window.LogConfig.isDebug
391
+
392
+ Log.trace()
393
+ Log.debug()
394
+ Log.info()
395
+ Log.warn()
396
+ Log.error()
397
+ Log.fatal()
398
+
399
+ // 展示 pkg 信息,不受 LogConfig 配置影响
400
+ Log.pkgInfo(name, version)
401
+
402
+ </code></pre>
403
+ <h3>store</h3>
404
+ <pre class="prettyprint source lang-js"><code>`default function list`
405
+ // 所有的cookie数据,均采用 escape/unescape 进行转码、解码
406
+ encrypt(str) // 加密
407
+ decrypt(str) // 解密
408
+ setCookieByDays(name, value, days)
409
+ getAllCookies() // 获取所有的cookie,同时每个key对应的value,均执行了 JSON.parse(value)
410
+ setCookieByHour(name, value, hour)
411
+ getCookieByName(name)
412
+ removeCookieByName(name)
413
+ clearAllCookie()
414
+
415
+ `localStorage`
416
+
417
+ const ls = Store.lsTool;
418
+
419
+ ls.read(key)
420
+ ls.write(key, data)
421
+ ls.each(fn)
422
+ ls.remove(key)
423
+ ls.clearAll()
424
+
425
+ `sessionStorage`
426
+
427
+ const session = Store.session;
428
+
429
+ session.read(key)
430
+ session.write(key, data)
431
+ session.each(fn)
432
+ session.remove(key)
433
+ session.clearAll()
434
+
435
+ </code></pre>
436
+ <h3>locationParam</h3>
437
+ <pre class="prettyprint source lang-js"><code> parse(paramString):
438
+ `if paramString is undefined, paramString=window.location.search`
439
+ `return all params Key Pair object`
440
+
441
+ paramSearch(name, target):
442
+ `if target is undefined, default window.location.search`
443
+ `and if name is undefined too `
444
+ `return keyValueObjec; else if name not empty return value;`
445
+
446
+ getLocationParams():
447
+ `get all locationParams, and return a key-value object`
448
+
449
+ getLocationParamByName(name):
450
+ `get param value by name, and return value or null`
451
+
452
+ getParameter(url, name):
453
+ `get target url Parameter by name, and return value or '' `
454
+
455
+ `LocationSearch` LocationParam.LocationSearch
456
+ `other search tool`
457
+ private: _keyValuePairs
458
+ public:
459
+ init():
460
+ `init this tool,set private property _keyValuePairs and return a LocationSearch`
461
+ getValue(key):
462
+ `return target value`
463
+ getParameters():
464
+ `return all param value`
465
+ </code></pre>
466
+ <h3>array2tree</h3>
467
+ <pre class="prettyprint source lang-js"><code>
468
+ import { array2tree } from 'amos-tool';
469
+
470
+ const data = [{
471
+ value: 'a',
472
+ children: [{
473
+ value: 'b',
474
+ children: [{
475
+ value: 'c'
476
+ }, {
477
+ value: 'd',
478
+ }]
479
+ }],
480
+ }];
481
+ const values = ['a', 'b', 'c'];
482
+ const result = array2tree(
483
+ data, (item, level) => item.value === values[level]
484
+ );
485
+
486
+ console.log(result);
487
+ // [
488
+ // { value: 'a', children: [...] },
489
+ // { value: 'b', children: [...] },
490
+ // { value: 'c', children: [...] }
491
+ // ]
492
+
493
+ </code></pre>
494
+ <h3>tableFilter</h3>
495
+ <pre class="prettyprint source lang-js"><code> getChildrenlength(children)
496
+
497
+ flatToHierarchy(arr)
498
+
499
+ filterParentPosition(arr)
500
+
501
+ isInclude(smallArray, bigArray)
502
+ /**
503
+ * 过滤数据
504
+ *
505
+ * @param {Array} vals 数据集合
506
+ * @param {any} treeData tree数据
507
+ * @returns
508
+ */
509
+ filterAllCheckedData(vals, treeData)
510
+
511
+ /**
512
+ * 递归
513
+ *
514
+ * @param {any} children
515
+ * @param {any} cb
516
+ */
517
+ recursive(children, cb)
518
+ </code></pre>
519
+ <h3>pwdPolicy</h3>
520
+ <pre class="prettyprint source lang-js"><code>
521
+ /**
522
+ * 普通密码生成策略
523
+ * @param {string} password
524
+ * @return {object} { password, secretKey }
525
+ */
526
+ normalPolicy(password)
527
+
528
+ /**
529
+ * 普通密码生成策略
530
+ * @param {string} password 密码
531
+ * @param {string} secretKey 秘钥
532
+ * @return {object} { password, secretKey }
533
+ */
534
+ advancePolicy(password, secretKey)
535
+
536
+ /**
537
+ * 采用MD5生成密码 (不可逆)
538
+ * @param {string} password
539
+ * @param {string} secretKey
540
+ */
541
+ useMd5Policy(password, secretKey)
542
+ </code></pre>
543
+ <h3>omit</h3>
544
+ <pre class="prettyprint source lang-js"><code> const ilex = {name: 'ilex', age: 18};
545
+ const copy = omit(ilex, ['']); // {name: 'ilex', age: 18};
546
+
547
+ const copy = omit(ilex, ['age']); // {name: 'ilex'}
548
+ const copy = omit(ilex, ['name', 'age']); // {}
549
+
550
+ </code></pre>
551
+ <h3>pick</h3>
552
+ <pre class="prettyprint source lang-js"><code> const ilex = {name: 'ilex', age: 18};
553
+ const copy = pick(ilex, ['']); // {};
554
+
555
+ const copy = pick(ilex, ['age']); // {age: 18}
556
+ const copy = pick(ilex, ['name', 'age']); // {name: 'ilex', age: 18}
557
+
558
+ </code></pre>
559
+ <h3>utils</h3>
560
+ <pre class="prettyprint source lang-js"><code> isString(obj);
561
+ // Is a given value an array?
562
+ // Delegates to ECMA5's native Array.isArray
563
+ `If you want to judge object and judge array, you need to judge array first`
564
+ isArray(obj);
565
+ // Is a given variable an object?
566
+ isObject(obj);
567
+ // Is a given array, string, or object empty?
568
+ // An &quot;empty&quot; object has no enumerable own-properties.
569
+ isEmpty(objOrArray);
570
+ // Is a given value equal to null?
571
+ isNull(obj);
572
+ // Is a given variable undefined?
573
+ isUndefined(obj);
574
+ // Is json
575
+ isJson(obj);
576
+ // is image src,支持的格式(jpe?g|png|gif|bmp|ico|tga) 及其 base64 格式
577
+ isImageSrc(url);
578
+ /**
579
+ * 将数字部分内容转化为 *
580
+ * @param {Number} number 目标 Number
581
+ * @param {Number} start 起始位置
582
+ * @param {Number} len 转换位数
583
+ * @param {String} sign 替换的字符
584
+ */
585
+ encodeNumber(number, start = 3, len = 4, sign = '*');
586
+ /**
587
+ * some
588
+ * some 为数组中的每一个元素执行一次 callback 函数,直到找到一个使得 callback 返回一个“真值”
589
+ * @param {Array} arr
590
+ * @param {function} fun
591
+ */
592
+ some(arr, fun /*, thisArg */ );
593
+ //
594
+ every(arr, callbackfn, thisArg);
595
+ //
596
+ reduce(arr, callback /*, initialValue*/);
597
+
598
+ mergeAll(targetAndSources, overwrite);
599
+
600
+ merge(target, source, overwrite);
601
+
602
+ clone(source);
603
+ </code></pre>
604
+ <h3>xss</h3>
605
+ <pre class="prettyprint source lang-js"><code>import htmlEncode from 'amos-tool/lib/xss/htmlEncode';
606
+ import implementEncode from 'amos-tool/lib/xss/implementEncode';
607
+
608
+ htmlEncode('&lt;'); // &lt
609
+ htmlEncode('>'); // &gt
610
+ htmlEncode('\''); // '
611
+ htmlEncode('\&quot;'); // &quot;
612
+ ...
613
+
614
+ implementEncode('&lt;script language=text/javascript>alert(document.cookie);&lt;/script>');
615
+ implementEncode('&lt;/script>');
616
+ implementEncode(' eval(abc);');
617
+ implementEncode('&lt;img src=&quot;&quot; onerror=&quot;alert(document.cookie);&quot;>&lt;/img>');
618
+ ...
619
+ </code></pre>
620
+ <h3>strUtils</h3>
621
+ <pre class="prettyprint source lang-js"><code> toCapitalStr(obj);
622
+ // 驼峰化, 仅支持首字母大写、或者采用中杠连接的两个字母首字母大写
623
+ // 如果要支持其它输入,将正则改为: /(-|(\s+)|_)(\w)/g
624
+ camelCase(obj);
625
+ // 将中缸连接的字符串 驼峰化
626
+ transCamel(obj);
627
+ // 字符串首字母大写
628
+ capFirst(objOrArray);
629
+ // 获取字符串的hashCode码
630
+ hashCode(obj);
631
+ // 进制与单位处理
632
+ dealScaleAndUnit(obj);
633
+ </code></pre>
634
+ <h3>other</h3>
635
+ <ul>
636
+ <li>
637
+ <p>cookie:</p>
638
+ </li>
639
+ <li>
640
+ <p>isNode
641
+ isNode();</p>
642
+ </li>
643
+ <li>
644
+ <p>objectAssign:</p>
645
+ <pre><code>objectAssign(target, source);
646
+ </code></pre>
647
+ </li>
648
+ <li>
649
+ <p>parseJson:</p>
650
+ <p>parseJson(data)</p>
651
+ </li>
652
+ <li>
653
+ <p>stringify:</p>
654
+ <p>stringify(json)</p>
655
+ </li>
656
+ <li>
657
+ <p>supportWs:</p>
658
+ <p>supportWs()</p>
659
+ </li>
660
+ <li>
661
+ <p>trim:</p>
662
+ <p>trim(str)</p>
663
+ </li>
664
+ <li>
665
+ <p>arrayFilter:</p>
666
+ </li>
667
+ <li>
668
+ <p>merged:</p>
669
+ <p>merged(args): combine object property</p>
670
+ </li>
671
+ <li>
672
+ <p>objectPath</p>
673
+ <p>@see <a href="doc/objectPath.md">doc/objectPath.md</a></p>
674
+ </li>
675
+ <li>
676
+ <p>random</p>
677
+ <p>random(len)
678
+ random.randomInt(min, max)</p>
679
+ </li>
680
+ </ul>
681
+ <h4>extra</h4>
682
+ <ul>
683
+ <li>pathToTree</li>
684
+ </ul>
685
+ <pre class="prettyprint source lang-js"><code>import pathToTree from 'amos-tool/lib/extra/pathToTree';
686
+
687
+ const arr = [
688
+ 'main/lib',
689
+ 'console/tt/design1',
690
+ 'console/mm/vizlib'
691
+ ];
692
+
693
+ const mapper = {
694
+ main: 'RootView',
695
+ console: 'ConsoleView'
696
+ };
697
+
698
+ var result1 = pathToTree(arr, {
699
+ pathKey: 'path',
700
+ childrenKey: 'childRoutes',
701
+ processor(item, wantedNode){
702
+ if (mapper[wantedNode]){
703
+ item.component = mapper[wantedNode];
704
+ }
705
+ }
706
+ });
707
+ </code></pre>
708
+ <h4>dom</h4>
709
+ <ul>
710
+ <li>canvas2img</li>
711
+ </ul>
712
+ <blockquote>
713
+ <p>saveAsImage(canvas/<em>canvasElement</em>/, width, height, type)
714
+ saveAsPNG(canvas, width, height)
715
+ saveAsGIF(canvas, width, height)
716
+ saveAsBMP(canvas, width, height)
717
+ convert2Image(canvas, width, height, type)
718
+ convert2data(canvas, type, width, height)
719
+ convert2Blob</p>
720
+ </blockquote>
721
+ <pre class="prettyprint source lang-js"><code>/**
722
+ * @param {Canvas} canvas
723
+ * @param {function} fn (blob) => {}
724
+ * @param {Object} options {
725
+ * type: '', // 图片类型 默认 'image/png',其它类型详见MIME手册
726
+ * width: number, // 宽
727
+ * height: number, // 高
728
+ * encoderOptions: 0-1 // 图片质量
729
+ * }
730
+ */
731
+ convert2Blob(canvas, fn, options)
732
+ </code></pre>
733
+ <blockquote>
734
+ <p>convert2PNG(canvas, width, height)
735
+ convert2JPEG(canvas, width, height)
736
+ convert2GIF(canvas, width, height)
737
+ convert2BMP(canvas, width, height)</p>
738
+ </blockquote>
739
+ <h2>changelog</h2>
740
+ <ul>
741
+ <li>
742
+ <p>v1.4.1
743
+ <code>*</code> add <code>pathToRoutes</code></p>
744
+ </li>
745
+ <li>
746
+ <p>v1.4.0
747
+ <code>*</code> add <code>pathToTree</code> to calc react router path</p>
748
+ </li>
749
+ <li>
750
+ <p>v1.3.21
751
+ <code>*</code> modify colorUtil</p>
752
+ </li>
753
+ <li>
754
+ <p>v1.3.19
755
+ <code>*</code> modify colorUtil
756
+ <code>*</code> modify <code>utils#getFileExtension</code>
757
+ <code>*</code> modify <code>index.d.ts</code></p>
758
+ </li>
759
+ <li>
760
+ <p>v1.3.14
761
+ <code>*</code> modify cookie encode method
762
+ <code>+</code> browser/indexDB</p>
763
+ </li>
764
+ <li>
765
+ <p>v1.3.13
766
+ <code>+</code> htmlEncode
767
+ <code>+</code> implementEncode</p>
768
+ </li>
769
+ </ul></article>
770
+ </section>
771
+
772
+
773
+
774
+
775
+
776
+
777
+
778
+
779
+ </div>
780
+
781
+ <br class="clear">
782
+
783
+ <footer>
784
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Tue May 24 2022 16:55:22 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
785
+ </footer>
786
+
787
+ <script>prettyPrint();</script>
788
+ <script src="scripts/polyfill.js"></script>
789
+ <script src="scripts/linenumber.js"></script>
790
+
791
+
792
+
793
+ </body>
794
+ </html>