amos-tool 1.6.4 → 1.6.5

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