qmwts 1.1.70 → 1.1.72
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const prototype_utils_1 = require("./prototype-utils");
|
|
4
|
+
const number_utils_1 = require("./number-utils");
|
|
4
5
|
exports.default = {
|
|
5
6
|
optionalChaining(o = {}, chain, substitute = '') {
|
|
6
7
|
const chaining = chain.split('.');
|
|
@@ -46,7 +47,10 @@ exports.default = {
|
|
|
46
47
|
// 都是对象或数组 → 递归比较
|
|
47
48
|
if (prototype_utils_1.default.isObject(valueA) && prototype_utils_1.default.isObject(valueB))
|
|
48
49
|
return this.contains(valueA, valueB);
|
|
49
|
-
|
|
50
|
+
if (prototype_utils_1.default.isArray(valueA) && prototype_utils_1.default.isArray(valueB))
|
|
51
|
+
return this.contains(valueA, valueB);
|
|
52
|
+
if (number_utils_1.default.isNumber(valueA) && number_utils_1.default.isNumber(valueB)) // 字符串数字和纯数字全部转为数字进行对比 '1' === 1
|
|
53
|
+
return +valueA === +valueB;
|
|
50
54
|
return valueA === valueB;
|
|
51
55
|
});
|
|
52
56
|
}
|