amos-tool 1.4.8 → 1.4.11

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 (37) hide show
  1. package/README.md +670 -667
  2. package/docs/Logger.html +347 -0
  3. package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  4. package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  5. package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  6. package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  7. package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  8. package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  9. package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  10. package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  11. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  12. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
  13. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  14. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  15. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  16. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  17. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
  18. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  19. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  20. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  21. package/docs/global.html +15168 -0
  22. package/docs/index.html +794 -0
  23. package/docs/scripts/collapse.js +20 -0
  24. package/docs/scripts/linenumber.js +25 -0
  25. package/docs/scripts/nav.js +12 -0
  26. package/docs/scripts/polyfill.js +4 -0
  27. package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
  28. package/docs/scripts/prettify/lang-css.js +2 -0
  29. package/docs/scripts/prettify/prettify.js +28 -0
  30. package/docs/scripts/search.js +83 -0
  31. package/docs/styles/jsdoc.css +765 -0
  32. package/docs/styles/prettify.css +79 -0
  33. package/index.d.ts +32 -0
  34. package/lib/_deepEqual.js +1 -1
  35. package/lib/log.js +19 -16
  36. package/lib/utils.js +14 -2
  37. package/package.json +1 -1
@@ -0,0 +1,79 @@
1
+ .pln {
2
+ color: #ddd;
3
+ }
4
+
5
+ /* string content */
6
+ .str {
7
+ color: #61ce3c;
8
+ }
9
+
10
+ /* a keyword */
11
+ .kwd {
12
+ color: #fbde2d;
13
+ }
14
+
15
+ /* a comment */
16
+ .com {
17
+ color: #aeaeae;
18
+ }
19
+
20
+ /* a type name */
21
+ .typ {
22
+ color: #8da6ce;
23
+ }
24
+
25
+ /* a literal value */
26
+ .lit {
27
+ color: #fbde2d;
28
+ }
29
+
30
+ /* punctuation */
31
+ .pun {
32
+ color: #ddd;
33
+ }
34
+
35
+ /* lisp open bracket */
36
+ .opn {
37
+ color: #000000;
38
+ }
39
+
40
+ /* lisp close bracket */
41
+ .clo {
42
+ color: #000000;
43
+ }
44
+
45
+ /* a markup tag name */
46
+ .tag {
47
+ color: #8da6ce;
48
+ }
49
+
50
+ /* a markup attribute name */
51
+ .atn {
52
+ color: #fbde2d;
53
+ }
54
+
55
+ /* a markup attribute value */
56
+ .atv {
57
+ color: #ddd;
58
+ }
59
+
60
+ /* a declaration */
61
+ .dec {
62
+ color: #EF5050;
63
+ }
64
+
65
+ /* a variable name */
66
+ .var {
67
+ color: #c82829;
68
+ }
69
+
70
+ /* a function name */
71
+ .fun {
72
+ color: #4271ae;
73
+ }
74
+
75
+ /* Specify class=linenums on a pre to get line numbering */
76
+ ol.linenums {
77
+ margin-top: 0;
78
+ margin-bottom: 0;
79
+ }
package/index.d.ts CHANGED
@@ -953,6 +953,38 @@ declare namespace utils {
953
953
  */
954
954
  export function encodeNumber(number: Number, start?: number, len?: number, sign?: string): String;
955
955
 
956
+ /**
957
+ * 获取扩展名
958
+ *
959
+ * 可快速使用 `filePath.split('.').pop();` 获取扩展名
960
+ * @param filePath
961
+ * @return {String} ext
962
+ * @example
963
+ * getFileExtension('a.png'); // png
964
+ * getFileExtension('a/a/a.png'); // png
965
+ * getFileExtension('a.a.a.png.jpg'); // jpg
966
+ * getFileExtension('a'); // ''
967
+ */
968
+ export function getFileExtension(filePath: string): String;
969
+
970
+ /**
971
+ * 将指定 size 中的数据,转化为 byte
972
+ * - 默认不区分大小写, mb/MB/Mb 均表示 mb
973
+ * - 默认去除内部所有空格, 1024 MB -> 1024mb
974
+ * - 无单位或者 number 类型,将直接转化为 number值,默认当 byte 处理
975
+ * @param size 带有单位的 size,不带单位时,直接返回该值
976
+ * @returns byte
977
+ * @example
978
+ * fileSizeToByte('1kb'); // 1024
979
+ * fileSizeToByte('1mb'); // 1048576
980
+ * fileSizeToByte('1MB'); // 1048576
981
+ * fileSizeToByte('1gb'); // 1073741824
982
+ * fileSizeToByte('1tb'); // 1099511627776
983
+ * fileSizeToByte('123'); // 123
984
+ * fileSizeToByte(123); // 123
985
+ */
986
+ export function fileSizeToByte(size: string): String;
987
+
956
988
  export function some(arr: Array<any>, fun: Function /*, thisArg */): boolean;
957
989
  export function every(arr: Array<any>, callbackfn: Function, thisArg): boolean;
958
990
  export function reduce(arr: Array<any>, callback: Function /*, initialValue*/);
package/lib/_deepEqual.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"), _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")), stringify = require("./_stringify"), utils = require("./utils"), deepEqual = function(e, i) {
4
4
  return !(utils.isEmpty(e) && !utils.isEmpty(i) || !utils.isEmpty(e) && utils.isEmpty(i)) && ((0,
5
- _typeof2.default)(e) === (0, _typeof2.default)(i) && (utils.isString(e) && utils.isString(i) || utils.isNumber(e) && utils.isNumber(i) ? e === i : stringify(e) === stringify(i)));
5
+ _typeof2.default)(e) === (0, _typeof2.default)(i) && (utils.isString(e) && utils.isString(i) || utils.isNumber(e) && utils.isNumber(i) ? e === i : utils.isArray(e) && utils.isArray(i) ? e.length === i.length : stringify(e) === stringify(i)));
6
6
  };
7
7
 
8
8
  module.exports = deepEqual;
package/lib/log.js CHANGED
@@ -1,31 +1,34 @@
1
1
  "use strict";
2
2
 
3
3
  var Logger = function() {
4
- var o = this, i = 0, t = 1, n = 2, r = 3, s = 4, g = 5, l = [ "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL" ];
5
- function c(i, t) {
6
- var n = [];
7
- for (var r in n.push(i), t) n.push(t[r]);
8
- o.log.apply(o, n);
4
+ var o = this, n = 0, i = 1, t = 2, r = 3, c = 4, g = 5, s = [ "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL" ];
5
+ function l(n, i) {
6
+ var t = [];
7
+ for (var r in t.push(n), i) t.push(i[r]);
8
+ o.log.apply(o, t);
9
9
  }
10
10
  this.log = function() {
11
- var o = arguments[0], i = o === s;
12
- if (o = arguments[0] = "[" + l[o] + "] ", window.LogConfig && window.LogConfig.isDebug && (console.log.apply(console, arguments),
13
- i)) try {
14
- var t = Array.prototype.slice.call(arguments);
15
- throw t = t.slice(1), new Error(t.join(","));
11
+ var o = arguments[0], n = o === c;
12
+ if (o = arguments[0] = "[" + s[o] + "] ", window.LogConfig && window.LogConfig.isDebug && (console.log.apply(console, arguments),
13
+ n)) try {
14
+ var i = Array.prototype.slice.call(arguments);
15
+ throw i = i.slice(1), new Error(i.join(","));
16
16
  } catch (o) {}
17
17
  }, this.trace = function() {
18
- this.log && c(i, arguments);
18
+ this.log && l(n, arguments);
19
19
  }, this.debug = function() {
20
- this.log && c(t, arguments);
20
+ this.log && l(i, arguments);
21
21
  }, this.info = function() {
22
- this.log && c(n, arguments);
22
+ this.log && l(t, arguments);
23
23
  }, this.warn = function() {
24
- this.log && c(r, arguments);
24
+ this.log && l(r, arguments);
25
25
  }, this.error = function() {
26
- this.log && c(s, arguments);
26
+ this.log && l(c, arguments);
27
27
  }, this.fatal = function() {
28
- this.log && c(g, arguments);
28
+ this.log && l(g, arguments);
29
+ }, this.pkgInfo = function(o) {
30
+ var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "1.0.0", i = "%c " + (o = o || "unknown") + " %c v".concat(n = n || "1.0.0", " "), t = "padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #4e5950; font-weight: bold;", r = "padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #49c31b; font-weight: bold;";
31
+ console.log(i, t, r);
29
32
  };
30
33
  };
31
34
 
package/lib/utils.js CHANGED
@@ -86,8 +86,7 @@ var null2default = function(e) {
86
86
  }, isJson = function(e) {
87
87
  return "object" === (0, _typeof2.default)(e) && "[object object]" === toString.call(e).toLowerCase() && !e.length;
88
88
  }, stringIsJson = function e(t) {
89
- return "[object String]" === toString.call(t) && (t = t.replace(/\s/g, "").replace(/\n|\r/, ""),
90
- /^\{(.*?)\}$/.test(t) ? /"(.*?)":(.*?)/g.test(t) : !!/^\[(.*?)\]$/.test(t) && t.replace(/^\[/, "").replace(/\]$/, "").replace(/},{/g, "}\n{").split(/\n/).map((function(t) {
89
+ return !!isString(t) && (t = t.replace(/\s/g, "").replace(/\n|\r/, ""), /^\{(.*?)\}$/.test(t) ? /"(.*?)":(.*?)/g.test(t) : !!/^\[(.*?)\]$/.test(t) && t.replace(/^\[/, "").replace(/\]$/, "").replace(/},{/g, "}\n{").split(/\n/).map((function(t) {
91
90
  return e(t);
92
91
  })).reduce((function(e, t) {
93
92
  return !!t;
@@ -119,6 +118,18 @@ var null2default = function(e) {
119
118
  return t > 0 ? e.substring(t + 1) : "";
120
119
  }
121
120
  return "";
121
+ }, fileSizeToByte = function(e) {
122
+ var t = {
123
+ t: 1099511627776,
124
+ g: 1073741824,
125
+ m: 1048576,
126
+ k: 1024
127
+ };
128
+ if (!e) return 0;
129
+ if (!isString(e)) return e;
130
+ e = e.toLocaleLowerCase().replace(/\s*/g, "");
131
+ var n = (e = /^([0-9\.]+)([tgmk]?)b?$/i.exec(e))[2];
132
+ return e = +e[1], t.hasOwnProperty(n) && (e *= t[n]), e;
122
133
  }, some = function(e, t) {
123
134
  if (null == e) throw new TypeError;
124
135
  var n = Object(e), r = n.length >>> 0;
@@ -228,6 +239,7 @@ module.exports = {
228
239
  isImageSrc: isImageSrc,
229
240
  encodeNumber: encodeNumber,
230
241
  getFileExtension: getFileExtension,
242
+ fileSizeToByte: fileSizeToByte,
231
243
  some: some,
232
244
  every: every,
233
245
  reduce: reduce,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amos-tool",
3
- "version": "1.4.8",
3
+ "version": "1.4.11",
4
4
  "description": "amos ui tool",
5
5
  "main": "index.js",
6
6
  "directories": {