amos-tool 1.4.8 → 1.4.9
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/README.md +670 -667
- package/lib/_deepEqual.js +1 -1
- package/lib/log.js +19 -16
- package/lib/utils.js +1 -2
- package/package.json +1 -1
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,
|
|
5
|
-
function
|
|
6
|
-
var
|
|
7
|
-
for (var r in
|
|
8
|
-
o.log.apply(o,
|
|
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],
|
|
12
|
-
if (o = arguments[0] = "[" +
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
throw
|
|
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 &&
|
|
18
|
+
this.log && l(n, arguments);
|
|
19
19
|
}, this.debug = function() {
|
|
20
|
-
this.log &&
|
|
20
|
+
this.log && l(i, arguments);
|
|
21
21
|
}, this.info = function() {
|
|
22
|
-
this.log &&
|
|
22
|
+
this.log && l(t, arguments);
|
|
23
23
|
}, this.warn = function() {
|
|
24
|
-
this.log &&
|
|
24
|
+
this.log && l(r, arguments);
|
|
25
25
|
}, this.error = function() {
|
|
26
|
-
this.log && c
|
|
26
|
+
this.log && l(c, arguments);
|
|
27
27
|
}, this.fatal = function() {
|
|
28
|
-
this.log &&
|
|
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
|
|
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;
|