amos-tool 1.5.0 → 1.5.2

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.
package/docs/index.html CHANGED
@@ -27,7 +27,9 @@
27
27
 
28
28
  <nav >
29
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#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#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#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#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>
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></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#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
33
  </nav>
32
34
 
33
35
  <div id="main">
@@ -783,13 +785,15 @@ convert2BMP(canvas, width, height)</p>
783
785
  <br class="clear">
784
786
 
785
787
  <footer>
786
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Thu Nov 10 2022 10:29:31 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
788
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Thu Mar 09 2023 13:58:14 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
787
789
  </footer>
788
790
 
789
791
  <script>prettyPrint();</script>
790
792
  <script src="scripts/polyfill.js"></script>
791
793
  <script src="scripts/linenumber.js"></script>
792
794
 
795
+ <script src="scripts/search.js" defer></script>
796
+
793
797
 
794
798
 
795
799
  </body>
package/index.d.ts CHANGED
@@ -254,6 +254,21 @@ declare namespace LocationParam {
254
254
  * completeParam({ token: 'xxddf', id: null }, true); // `http://localhost:8080/aaa?token=xxddf&id=`
255
255
  */
256
256
  export function completeParam(param: Object, url: string, forceCast: Boolean): string;
257
+ /**
258
+ * 替换 url 参数
259
+ * @param href 需要替换参数的 url
260
+ * @param params 参数对象
261
+ * @example
262
+ * changeParam('a/b/d/g?a=aa&b=bb&c=cc', { a: 1, b: 2, c: 3 }); // 'a/b/d/g?a=1&b=2&c=3'
263
+ * changeParam('a/b/d/g?a=aa&b=bb&c=cc', { a: 1, b: 2, c: 3, d: 5 }); // 'a/b/d/g?a=1&b=2&c=3&d=5'
264
+ */
265
+ export function changeParam(href: String, params: Object): String;
266
+ /**
267
+ * 更新浏览器地址栏地址
268
+ * @param param
269
+ * @param href 指定的地址,如果不指定,则采用 location.href
270
+ */
271
+ export function replaceUrl(param: Object, href?: String): void;
257
272
  export type LocationSearch = { init(): void; getValue(key: string): string; getParameters(): Array<any> };
258
273
  export type LSFN = { getValue(): string; getParameters(): Array<any> };
259
274
  }
@@ -319,6 +334,8 @@ declare namespace Store {
319
334
  export function write(key: string, data: string): any;
320
335
  export function each(fn: (value: string, key: string) => {}): void;
321
336
  export function remove(key: string): void;
337
+ export function fuzzyRemove(fn: (key: String) => Boolean): void;
338
+ export function allKeys(): String[];
322
339
  export function clearAll(): void;
323
340
  }
324
341
  /**
@@ -330,6 +347,8 @@ declare namespace Store {
330
347
  export function write(key: string, data: string): any;
331
348
  export function each(fn: (value: string, key: string) => {}): void;
332
349
  export function remove(key: string): void;
350
+ export function fuzzyRemove(fn: (key: String) => Boolean): void;
351
+ export function allKeys(): String[];
333
352
  export function clearAll(): void;
334
353
  }
335
354
  }
@@ -639,6 +658,15 @@ export function omit(obj: object, keys: string | Array<String>): any;
639
658
  * pick({ name: 'ilex', age: 16 }, ['']); // {}
640
659
  */
641
660
  export function pick(obj: Object | Function, keys: string | Array<String>): Object;
661
+ /**
662
+ * 从指定的 obj 中获取 满足 judge(key, value) 组成新的对象
663
+ *
664
+ * @param obj
665
+ * @param judge
666
+ * @example
667
+ * pickBy({ a: 1, b: 2, c: 'ray' }, (key, value) => typeof value === 'number')
668
+ */
669
+ export function pickBy(obj: Object | Function, judge: (key, value) => Boolean): Object;
642
670
  /**
643
671
  * 将数据转化为json
644
672
  * @param data
@@ -986,6 +1014,11 @@ declare namespace utils {
986
1014
  * @returns boolean true 是 false不是
987
1015
  */
988
1016
  export function isJson(obj: any): boolean;
1017
+
1018
+ export function isSymbol(obj: any): boolean;
1019
+ export function isNullOrUndefined(obj: any): boolean;
1020
+ export function isDate(obj: any): boolean;
1021
+
989
1022
  /**
990
1023
  * 判断string能否被转成json
991
1024
  * 参数 str 如果不是 string 则直接返回 false
@@ -1007,6 +1040,11 @@ declare namespace utils {
1007
1040
  * @param obj
1008
1041
  */
1009
1042
  export function isOwnKeyInObject(keys: string | string[], obj: any): boolean;
1043
+ /**
1044
+ * 判断是否是 promise
1045
+ * @param value
1046
+ */
1047
+ export function isPromise(value: any): boolean;
1010
1048
  export function simpleEqual(objA: object, objB: object): boolean;
1011
1049
  /**
1012
1050
  * 判断是一个 image 的路径
package/lib/_pickBy.js ADDED
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ var _utils = require("./utils");
4
+
5
+ module.exports = function(t, r) {
6
+ if (!_utils.isObject(t)) return {};
7
+ var i = {};
8
+ if (_utils.isFunction(r)) for (var e = Object.keys(t), u = 0, s = e.length; u < s; u++) {
9
+ var n = e[u];
10
+ r(n, t[n]) && (i[n] = t[n]);
11
+ }
12
+ return i;
13
+ };
package/lib/amostool.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var Base64 = require("./encrypt/_base64"), MD5 = require("./encrypt/_md5"), DES = require("./encrypt/des"), Browser = require("./_browser"), cloneTools = require("./_clone"), amosCookie = require("./_cookie"), deepCopy = require("./_deepCopy"), deepEqual = require("./_deepEqual"), _fastDeepEqual = require("./_fastDeepEqual"), funcThrottle = require("./_funcThrottle"), isNode = require("./_isnode"), List = require("./_list"), _objectAssign = require("./_object.assign"), _objectEntries = require("./_object.entries"), _objectValues = require("./_object.values"), omit = require("./_omit"), pick = require("./_pick"), parseJson = require("./_parseJson"), Queue = require("./_queue"), shallowCopy = require("./_shallowCopy"), stringify = require("./_stringify"), supportWs = require("./_supportWs"), trim = require("./_trim"), UUID = require("./_uuids"), array2tree = require("./array2tree"), arrayFilter = require("./arrayFilter"), arrayUtils = require("./arrayUtils"), browserSupport = require("./browserSupport"), completeUnit = require("./completeUnit"), consts = require("./consts"), flat = require("./flat"), LocationParam = require("./locationParams"), Log = require("./log"), merged = require("./merged"), objectPath = require("./objectPath"), parseText = require("./parseText"), pwdPolicy = require("./pwdPolicy"), random = require("./random"), shallowEqual = require("./shallowEqual"), Store = require("./store"), strUtils = require("./strUtils"), tableFilter = require("./tableFilter"), utils = require("./utils"), canvas2img = require("./dom/canvas2img"), canvasTools = require("./dom/canvasTools"), downloadFile = require("./dom/downloadFile"), eventHelper = require("./dom/eventHelper"), fileBlob = require("./dom/fileBlob"), fileSaveAs = require("./dom/fileSaveAs"), getFontSize = require("./dom/getFontSize"), minfyImg = require("./dom/minfyImg"), addition = require("./math/addition"), amountCase = require("./math/amountCase"), coinFormat = require("./math/coinFormat"), colorUtil = require("./math/colorUtil"), dateTime = require("./math/dateTime"), pwdStrength = require("./math/pwdStrength"), randomColor = require("./math/randomColor"), subtraction = require("./math/subtraction"), accMul = require("./math/mul"), qs = require("./qs"), encodeUrl = require("./url/encodeUrl"), restfulUrl = require("./url/restfulUrl"), positionFactory = require("./positionFactory"), throttleDebounce = require("./throttleDebounce"), checkFlash = require("./_flashSupport");
3
+ var Base64 = require("./encrypt/_base64"), MD5 = require("./encrypt/_md5"), DES = require("./encrypt/des"), Browser = require("./_browser"), cloneTools = require("./_clone"), amosCookie = require("./_cookie"), deepCopy = require("./_deepCopy"), deepEqual = require("./_deepEqual"), _fastDeepEqual = require("./_fastDeepEqual"), funcThrottle = require("./_funcThrottle"), isNode = require("./_isnode"), List = require("./_list"), _objectAssign = require("./_object.assign"), _objectEntries = require("./_object.entries"), _objectValues = require("./_object.values"), omit = require("./_omit"), pick = require("./_pick"), pickBy = require("./_pickBy"), parseJson = require("./_parseJson"), Queue = require("./_queue"), shallowCopy = require("./_shallowCopy"), stringify = require("./_stringify"), supportWs = require("./_supportWs"), trim = require("./_trim"), UUID = require("./_uuids"), array2tree = require("./array2tree"), arrayFilter = require("./arrayFilter"), arrayUtils = require("./arrayUtils"), browserSupport = require("./browserSupport"), completeUnit = require("./completeUnit"), consts = require("./consts"), flat = require("./flat"), LocationParam = require("./locationParams"), Log = require("./log"), merged = require("./merged"), objectPath = require("./objectPath"), parseText = require("./parseText"), pwdPolicy = require("./pwdPolicy"), random = require("./random"), shallowEqual = require("./shallowEqual"), Store = require("./store"), strUtils = require("./strUtils"), tableFilter = require("./tableFilter"), utils = require("./utils"), canvas2img = require("./dom/canvas2img"), canvasTools = require("./dom/canvasTools"), downloadFile = require("./dom/downloadFile"), escapeHtml = require("./dom/escapeHtml"), eventHelper = require("./dom/eventHelper"), fileBlob = require("./dom/fileBlob"), fileSaveAs = require("./dom/fileSaveAs"), getFontSize = require("./dom/getFontSize"), minfyImg = require("./dom/minfyImg"), addition = require("./math/addition"), amountCase = require("./math/amountCase"), coinFormat = require("./math/coinFormat"), colorUtil = require("./math/colorUtil"), dateTime = require("./math/dateTime"), pwdStrength = require("./math/pwdStrength"), randomColor = require("./math/randomColor"), subtraction = require("./math/subtraction"), accMul = require("./math/mul"), qs = require("./qs"), encodeUrl = require("./url/encodeUrl"), restfulUrl = require("./url/restfulUrl"), positionFactory = require("./positionFactory"), throttleDebounce = require("./throttleDebounce"), checkFlash = require("./_flashSupport");
4
4
 
5
5
  module.exports = {
6
6
  Base64: Base64,
@@ -20,6 +20,7 @@ module.exports = {
20
20
  objectValues: _objectValues,
21
21
  omit: omit,
22
22
  pick: pick,
23
+ pickBy: pickBy,
23
24
  parseJson: parseJson,
24
25
  Queue: Queue,
25
26
  shallowCopy: shallowCopy,
@@ -50,6 +51,7 @@ module.exports = {
50
51
  canvas2img: canvas2img,
51
52
  canvasTools: canvasTools,
52
53
  downloadFile: downloadFile,
54
+ escapeHtml: escapeHtml,
53
55
  eventHelper: eventHelper,
54
56
  fileBlob: fileBlob,
55
57
  fileSaveAs: fileSaveAs,
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ var matchHtmlRegExp = /["'&<>]/;
4
+
5
+ module.exports = function(e) {
6
+ var t, a = "" + e, r = matchHtmlRegExp.exec(a);
7
+ if (!r) return a;
8
+ var c = "", s = 0, n = 0;
9
+ for (s = r.index; s < a.length; s++) {
10
+ switch (a.charCodeAt(s)) {
11
+ case 34:
12
+ t = "&quot;";
13
+ break;
14
+
15
+ case 38:
16
+ t = "&amp;";
17
+ break;
18
+
19
+ case 39:
20
+ t = "&#39;";
21
+ break;
22
+
23
+ case 60:
24
+ t = "&lt;";
25
+ break;
26
+
27
+ case 62:
28
+ t = "&gt;";
29
+ break;
30
+
31
+ default:
32
+ continue;
33
+ }
34
+ n !== s && (c += a.substring(n, s)), n = s + 1, c += t;
35
+ }
36
+ return n !== s ? c + a.substring(n, s) : c;
37
+ };
@@ -1,122 +1,141 @@
1
1
  "use strict";
2
2
 
3
3
  var utils = require("./utils"), _LSFN = function() {
4
- var t = [];
4
+ var n = [];
5
5
  return function() {
6
- var n = window.location.search;
7
- if (utils.isEmpty(n)) throw new Error("the [window.location.search] not empty!");
8
- var e = n.length > 1 ? n.substring(1) : null;
9
- utils.isNull(e) || (t = [].slice.call(e.split("&")));
6
+ var t = window.location.search;
7
+ if (utils.isEmpty(t)) throw new Error("the [window.location.search] not empty!");
8
+ var e = t.length > 1 ? t.substring(1) : null;
9
+ utils.isNull(e) || (n = [].slice.call(e.split("&")));
10
10
  }(), {
11
- getValue: function(n) {
12
- t.forEach((function(t) {
13
- var e = t.split("=");
14
- if (e[0] === n) return e[1];
11
+ getValue: function(t) {
12
+ n.forEach((function(n) {
13
+ var e = n.split("=");
14
+ if (e[0] === t) return e[1];
15
15
  }));
16
16
  },
17
17
  getParameters: function() {
18
- var n = [];
19
- return t.forEach((function(t) {
20
- n.push(t.split("=")[0]);
21
- })), n;
18
+ var t = [];
19
+ return n.forEach((function(n) {
20
+ t.push(n.split("=")[0]);
21
+ })), t;
22
22
  }
23
23
  };
24
24
  }, _LocationSearch = {
25
25
  _keyValuePairs: [],
26
26
  init: function() {
27
- var t = window.location.search;
28
- if (utils.isEmpty(t)) throw new Error("the [window.location.search] not empty!");
29
- var n = t.length > 1 ? t.substring(1) : null;
30
- return utils.isNull(n) || (_LocationSearch._keyValuePairs = [].slice.call(n.split("&"))),
27
+ var n = window.location.search;
28
+ if (utils.isEmpty(n)) throw new Error("the [window.location.search] not empty!");
29
+ var t = n.length > 1 ? n.substring(1) : null;
30
+ return utils.isNull(t) || (_LocationSearch._keyValuePairs = [].slice.call(t.split("&"))),
31
31
  this;
32
32
  },
33
- getValue: function(t) {
34
- _LocationSearch._keyValuePairs.forEach((function(n) {
35
- var e = n.split("=");
36
- if (e[0] === t) return e[1];
33
+ getValue: function(n) {
34
+ _LocationSearch._keyValuePairs.forEach((function(t) {
35
+ var e = t.split("=");
36
+ if (e[0] === n) return e[1];
37
37
  }));
38
38
  },
39
39
  getParameters: function() {
40
- var t = [];
41
- return _LocationSearch._keyValuePairs.forEach((function(n) {
42
- t.push(n.split("=")[0]);
43
- })), t;
40
+ var n = [];
41
+ return _LocationSearch._keyValuePairs.forEach((function(t) {
42
+ n.push(t.split("=")[0]);
43
+ })), n;
44
44
  }
45
45
  }, LocationParam = {
46
- parse: function(t) {
47
- var n, e, i, o, r;
48
- t || (t = window.location.search);
49
- var a = {}, l = [];
50
- if (!utils.isEmpty(t) && t.length > 1) for (o = 0, r = (l = t.slice(1 + t.indexOf("?"), t.length).split("&")).length; o < r; o++) n = (e = (e = l[o]).split("="))[0],
51
- i = e[1], n in a ? (utils.isArray(a[n]) || (a[n] = [ a[n] ]), a[n].push(decodeURIComponent(i))) : a[n] = decodeURIComponent(i);
46
+ parse: function(n) {
47
+ var t, e, i, r, o;
48
+ n || (n = window.location.search);
49
+ var a = {}, c = [];
50
+ if (!utils.isEmpty(n) && n.length > 1) for (r = 0, o = (c = n.slice(1 + n.indexOf("?"), n.length).split("&")).length; r < o; r++) t = (e = (e = c[r]).split("="))[0],
51
+ i = e[1], t in a ? (utils.isArray(a[t]) || (a[t] = [ a[t] ]), a[t].push(decodeURIComponent(i))) : a[t] = decodeURIComponent(i);
52
52
  return a;
53
53
  },
54
- paramSearch: function(t, n) {
55
- if (utils.isUndefined(n) || utils.isNull(n)) {
56
- if (n = window.location.search, utils.isUndefined(t) || utils.isNull(t)) {
57
- for (var e = n.substr(1, n.length - 1).split("&"), i = {}, o = 0; o < e.length; o++) {
58
- var r = e[o].split("=");
59
- 1 === r.length ? i[r[0]] = "" : 2 === r.length ? i[r[0]] = decodeURIComponent(r[1]) : console.log("there is something wrong when use [paramSearch]!");
54
+ paramSearch: function(n, t) {
55
+ if (utils.isUndefined(t) || utils.isNull(t)) {
56
+ if (t = window.location.search, utils.isUndefined(n) || utils.isNull(n)) {
57
+ for (var e = t.substr(1, t.length - 1).split("&"), i = {}, r = 0; r < e.length; r++) {
58
+ var o = e[r].split("=");
59
+ 1 === o.length ? i[o[0]] = "" : 2 === o.length ? i[o[0]] = decodeURIComponent(o[1]) : console.log("there is something wrong when use [paramSearch]!");
60
60
  }
61
61
  return i;
62
62
  }
63
63
  try {
64
- var a = new RegExp(t + "=([^&]+)?");
65
- return decodeURIComponent(n.match(a)[1]);
66
- } catch (t) {
64
+ var a = new RegExp(n + "=([^&]+)?");
65
+ return decodeURIComponent(t.match(a)[1]);
66
+ } catch (n) {
67
67
  return null;
68
68
  }
69
69
  }
70
70
  },
71
71
  getLocationParams: function() {
72
- var t, n, e = {}, i = window.location.href;
72
+ var n, t, e = {}, i = window.location.href;
73
73
  if (!utils.isEmpty(i)) {
74
- var o = i.indexOf("?");
75
- if (o < -1) console.log("the location.href is invalid!"); else for (var r = (i = i.substr(o + 1)).split("&"), a = 0; a < r.length; a++) (o = r[a].indexOf("=")) > 0 && (t = r[a].substring(0, o),
76
- n = r[a].substr(o + 1), e[t] = decodeURIComponent(n));
74
+ var r = i.indexOf("?");
75
+ if (r < -1) console.log("the location.href is invalid!"); else for (var o = (i = i.substr(r + 1)).split("&"), a = 0; a < o.length; a++) (r = o[a].indexOf("=")) > 0 && (n = o[a].substring(0, r),
76
+ t = o[a].substr(r + 1), e[n] = decodeURIComponent(t));
77
77
  }
78
78
  return e;
79
79
  },
80
- getLocationParamByName: function(t) {
81
- var n = new RegExp("(^|&?)".concat(t, "=([^&]*)(&|$)")), e = window.location.search.substr(1).match(n);
80
+ getLocationParamByName: function(n) {
81
+ var t = new RegExp("(^|&?)".concat(n, "=([^&]*)(&|$)")), e = window.location.search.substr(1).match(t);
82
82
  return null != e ? decodeURIComponent(e[2]) : null;
83
83
  },
84
- getParameter: function(t, n) {
85
- var e = new RegExp("(\\?|#|&)" + n + "=([^&#]*)(&|#|$)"), i = t.match(e);
84
+ getParameter: function(n, t) {
85
+ var e = new RegExp("(\\?|#|&)" + t + "=([^&#]*)(&|#|$)"), i = n.match(e);
86
86
  return i ? i[2] : "";
87
87
  },
88
- extractParam: function(t, n) {
89
- if (!t) return null;
90
- var e = new RegExp("(^|&?)".concat(n, "=([^&]*)(&|$)")), i = t.substr(1).match(e);
88
+ extractParam: function(n, t) {
89
+ if (!n) return null;
90
+ var e = new RegExp("(^|&?)".concat(t, "=([^&]*)(&|$)")), i = n.substr(1).match(e);
91
91
  return utils.isNil(i) ? null : decodeURIComponent(i[2]);
92
92
  },
93
- extractParams: function(t) {
94
- var n, e, i = {}, o = t || window.location.href;
95
- if (!utils.isEmpty(o)) {
96
- var r = o.indexOf("?");
97
- if (r < -1) console.log("the location.href is invalid!"); else for (var a = (o = o.substr(r + 1)).split("&"), l = 0; l < a.length; l++) (r = a[l].indexOf("=")) > 0 && (n = a[l].substring(0, r),
98
- e = a[l].substr(r + 1), i[n] = decodeURIComponent(e));
93
+ extractParams: function(n) {
94
+ var t, e, i = {}, r = n || window.location.href;
95
+ if (!utils.isEmpty(r)) {
96
+ var o = r.indexOf("?");
97
+ if (o < -1) console.log("the location.href is invalid!"); else for (var a = (r = r.substr(o + 1)).split("&"), c = 0; c < a.length; c++) (o = a[c].indexOf("=")) > 0 && (t = a[c].substring(0, o),
98
+ e = a[c].substr(o + 1), i[t] = decodeURIComponent(e));
99
99
  }
100
100
  return i;
101
101
  },
102
- extractParamAll: function(t) {
103
- var n, e, i = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], o = {}, r = t || window.location.href;
104
- if (!utils.isEmpty(r)) {
105
- var a = r.indexOf("?");
106
- if (a < -1) console.log("the location.href is invalid!"); else for (var l = (r = r.substr(a + 1)).split("&"), s = 0; s < l.length; s++) (a = l[s].indexOf("=")) > 0 && (n = l[s].substring(0, a),
107
- e = l[s].substr(a + 1), o[n] = i ? decodeURIComponent(e) : e);
102
+ extractParamAll: function(n) {
103
+ var t, e, i = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], r = {}, o = n || window.location.href;
104
+ if (!utils.isEmpty(o)) {
105
+ var a = o.indexOf("?");
106
+ if (a < -1) console.log("the location.href is invalid!"); else for (var c = (o = o.substr(a + 1)).split("&"), l = 0; l < c.length; l++) (a = c[l].indexOf("=")) > 0 && (t = c[l].substring(0, a),
107
+ e = c[l].substr(a + 1), r[t] = i ? decodeURIComponent(e) : e);
108
108
  }
109
- return o;
109
+ return r;
110
110
  },
111
- completeParam: function(t, n, e) {
111
+ completeParam: function(n, t, e) {
112
112
  var i = arguments;
113
- 1 === i.length ? n || (n = window.location.href) : 2 === i.length && utils.isBoolean(n) && (e = n,
114
- n = window.location.href), utils.isUndefined(e) && (e = !1), n || (n = window.location.href);
115
- var o = (Object.keys(t) || []).reduce((function(n, i) {
116
- var o = t[i];
117
- return e && (utils.isNull(o) || utils.isUndefined(o)) && (o = ""), n += "&".concat(i, "=").concat(o);
113
+ 1 === i.length ? t || (t = window.location.href) : 2 === i.length && utils.isBoolean(t) && (e = t,
114
+ t = window.location.href), utils.isUndefined(e) && (e = !1), t || (t = window.location.href);
115
+ var r = (Object.keys(n) || []).reduce((function(t, i) {
116
+ var r = n[i];
117
+ return e && (utils.isNull(r) || utils.isUndefined(r)) && (r = ""), t += "&".concat(i, "=").concat(r);
118
118
  }), "");
119
- return o ? (o = o.slice(1), -1 !== n.indexOf("?") ? n.endsWith("?") ? "".concat(n).concat(o) : "".concat(n, "&").concat(o) : "".concat(n, "?").concat(o)) : n;
119
+ return r ? (r = r.slice(1), -1 !== t.indexOf("?") ? t.endsWith("?") ? "".concat(t).concat(r) : "".concat(t, "&").concat(r) : "".concat(t, "?").concat(r)) : t;
120
+ },
121
+ changeParam: function(n, t) {
122
+ if (!n || utils.isEmpty(t)) return n;
123
+ var e = n;
124
+ return Object.keys(t).forEach((function(n) {
125
+ var i = t[n];
126
+ utils.isUndefined(i) && (i = ""), e = function(n, t, e) {
127
+ var i = t + "=([^&]*)", r = t + "=" + e;
128
+ if (n.match(i)) {
129
+ var o = new RegExp("(".concat(t, "=)([^&]*)"), "gi");
130
+ return n.replace(o, r);
131
+ }
132
+ return n.match("[?]") ? n + "&" + r : n + "?" + r;
133
+ }(e, n, i);
134
+ })), e;
135
+ },
136
+ replaceUrl: function(n, t) {
137
+ var e = t || location.href;
138
+ e = LocationParam.changeParam(e, n), location.replace(e);
120
139
  },
121
140
  LocationSearch: _LocationSearch,
122
141
  LSFN: _LSFN
package/lib/parseText.js CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  var utils = require("./utils"), defaultRE = /\{((?:.|\n)+?)\}/g;
4
4
 
5
- module.exports = function(e, t, u) {
6
- return u || (u = defaultRE), e && e.replace ? e.replace(u, (function(e, u) {
7
- return utils.isUndefined(t[u]) ? e : t[u];
5
+ module.exports = function(e, i, t, u) {
6
+ return t || (t = defaultRE), e && e.replace ? e.replace(t, (function(e, t) {
7
+ return utils.isUndefined(i[t]) ? !utils.isUndefined(i[t]) || utils.isUndefined(u) && "" !== u ? e : u : i[t];
8
8
  })) : e;
9
9
  };
package/lib/png/pnglib.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * @version 1.0
7
7
  * @author Robert Eisele <robert@xarg.org>
8
8
  * @copyright Copyright (c) 2010, Robert Eisele
9
- * @link http://www.xarg.org/2010/03/generate-client-side-png-files-using-javascript/
9
+ * @see http://www.xarg.org/2010/03/generate-client-side-png-files-using-javascript/
10
10
  * @license http://www.opensource.org/licenses/bsd-license.php BSD License
11
11
  *
12
12
  */ function write(t, i) {
package/lib/store.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
- var _Base64 = require("./encrypt/_base64"), trim = require("./_trim"), Global = "undefined" != typeof window ? window : global, doc = Global.document, _localStorage = {
4
- localStorage: Global.localStorage,
3
+ var _Base64 = require("./encrypt/_base64"), trim = require("./_trim"), _Global = "undefined" != typeof window ? window : global, doc = _Global.document, _localStorage = {
4
+ localStorage: _Global.localStorage,
5
5
  read: function(e) {
6
6
  return _localStorage.localStorage.getItem(e);
7
7
  },
@@ -17,11 +17,24 @@ var _Base64 = require("./encrypt/_base64"), trim = require("./_trim"), Global =
17
17
  remove: function(e) {
18
18
  return _localStorage.localStorage.removeItem(e);
19
19
  },
20
+ fuzzyRemove: function(e) {
21
+ for (var o = _localStorage.localStorage.length - 1; o >= 0; o--) {
22
+ var r = _localStorage.localStorage.key(o);
23
+ e(r) && _localStorage.remove(r);
24
+ }
25
+ },
26
+ allKeys: function() {
27
+ for (var e = [], o = _localStorage.localStorage.length - 1; o >= 0; o--) {
28
+ var r = _localStorage.localStorage.key(o);
29
+ e.push(r);
30
+ }
31
+ return e;
32
+ },
20
33
  clearAll: function() {
21
34
  return _localStorage.localStorage.clear();
22
35
  }
23
36
  }, _sessionStorage = {
24
- sessionStorage: Global.sessionStorage,
37
+ sessionStorage: _Global.sessionStorage,
25
38
  read: function(e) {
26
39
  return _sessionStorage.sessionStorage.getItem(e);
27
40
  },
@@ -37,6 +50,19 @@ var _Base64 = require("./encrypt/_base64"), trim = require("./_trim"), Global =
37
50
  remove: function(e) {
38
51
  return _sessionStorage.sessionStorage.removeItem(e);
39
52
  },
53
+ fuzzyRemove: function(e) {
54
+ for (var o = _sessionStorage.sessionStorage.length - 1; o >= 0; o--) {
55
+ var r = _sessionStorage.sessionStorage.key(o);
56
+ e(r) && _sessionStorage.remove(r);
57
+ }
58
+ },
59
+ allKeys: function() {
60
+ for (var e = [], o = _sessionStorage.sessionStorage.length - 1; o >= 0; o--) {
61
+ var r = _sessionStorage.sessionStorage.key(o);
62
+ e.push(r);
63
+ }
64
+ return e;
65
+ },
40
66
  clearAll: function() {
41
67
  return _sessionStorage.sessionStorage.clear();
42
68
  }
@@ -61,8 +87,8 @@ var _Base64 = require("./encrypt/_base64"), trim = require("./_trim"), Global =
61
87
  var e = {}, o = doc.cookie;
62
88
  if ("" === o) return e;
63
89
  for (var r = o.split("; "), t = 0; t < r.length; t++) {
64
- var a = r[t], n = a.indexOf("="), s = a.substring(0, n), i = a.substring(n + 1);
65
- i = JSON.parse(unescape(i)), e[s] = i;
90
+ var a = r[t], n = a.indexOf("="), s = a.substring(0, n), l = a.substring(n + 1);
91
+ l = JSON.parse(unescape(l)), e[s] = l;
66
92
  }
67
93
  return e;
68
94
  },
package/lib/utils.js CHANGED
@@ -37,7 +37,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
37
37
  return void 0 === e;
38
38
  }, isNil = function(e) {
39
39
  return null == e;
40
- }, isEmptyObject = function(e) {
40
+ };
41
+
42
+ function isNullOrUndefined(e) {
43
+ return null == e;
44
+ }
45
+
46
+ var isEmptyObject = function(e) {
41
47
  if (e) for (var t in e) if (hasOwnProperty.call(e, t)) return !1;
42
48
  return !0;
43
49
  }, has = function(e, t) {
@@ -87,6 +93,14 @@ var null2default = function(e) {
87
93
  return "object" === (0, _typeof2.default)(e) && "[object object]" === toString.call(e).toLowerCase() && !e.length;
88
94
  };
89
95
 
96
+ function isSymbol(e) {
97
+ return "symbol" === (0, _typeof2.default)(e);
98
+ }
99
+
100
+ function isDate(e) {
101
+ return "[object Date]" === toString.call(e);
102
+ }
103
+
90
104
  function _isJSON(e) {
91
105
  return !!isString(e) && (e = e.replace(/\s/g, "").replace(/\n|\r/, ""), /^\{(.*?)\}$/.test(e) ? /"(.*?)":(.*?)/g.test(e) : !!/^\[(.*?)\]$/.test(e) && e.replace(/^\[/, "").replace(/\]$/, "").replace(/},{/g, "}\n{").split(/\n/).map((function(e) {
92
106
  return _isJSON(e);
@@ -227,6 +241,15 @@ function isPromise(e) {
227
241
  return !isNull(e) && "object" === (0, _typeof2.default)(e) && (e instanceof Promise || "[object Promise]" === toString.call(e) || e.then && isFunction(e.then));
228
242
  }
229
243
 
244
+ function slpitArray(e, t) {
245
+ var n = e.length, r = [];
246
+ if (t <= n) for (var i = Math.ceil(n / t), o = 0; o < t; o++) {
247
+ var s = e.slice(o * i, o * i + i);
248
+ r.push(s);
249
+ } else r.push(e.slice());
250
+ return r;
251
+ }
252
+
230
253
  module.exports = {
231
254
  isString: isString,
232
255
  isArray: isArray,
@@ -241,6 +264,7 @@ module.exports = {
241
264
  isNull: isNull,
242
265
  isUndefined: isUndefined,
243
266
  isNil: isNil,
267
+ isNullOrUndefined: isNullOrUndefined,
244
268
  has: has,
245
269
  values: values,
246
270
  noop: noop,
@@ -254,6 +278,8 @@ module.exports = {
254
278
  isBuiltInObject: isBuiltInObject,
255
279
  null2default: null2default,
256
280
  isJson: isJson,
281
+ isSymbol: isSymbol,
282
+ isDate: isDate,
257
283
  stringIsJson: stringIsJson,
258
284
  isKeyInObject: isKeyInObject,
259
285
  isOwnKeyInObject: isOwnKeyInObject,
@@ -272,5 +298,6 @@ module.exports = {
272
298
  merge: merge,
273
299
  mergeAll: mergeAll,
274
300
  subObjectEqual: subObjectEqual,
275
- isPromise: isPromise
301
+ isPromise: isPromise,
302
+ slpitArray: slpitArray
276
303
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amos-tool",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "amos ui tool",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -31,8 +31,7 @@
31
31
  },
32
32
  "types": "index.d.ts",
33
33
  "homepage": "",
34
- "dependencies": {
35
- },
34
+ "dependencies": {},
36
35
  "devDependencies": {
37
36
  "assert": "^1.4.1",
38
37
  "chai": "~3.4.1",