amos-tool 1.4.4 → 1.4.8

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