ut2 1.5.3 → 1.5.5

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  一个现代 JavaScript 实用工具库。[点击查看在线文档]。
4
4
 
5
- [![npm][npm]][npm-url] [![Build and Deploy Docs](https://github.com/caijf/ut2/actions/workflows/ci.yml/badge.svg)](https://github.com/caijf/ut2/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/caijf/ut2/branch/main/graph/badge.svg?token=XKTS0H7085)](https://codecov.io/gh/caijf/ut2) ![npm](https://img.shields.io/npm/dt/ut2) ![GitHub](https://img.shields.io/github/license/caijf/ut2.svg)
5
+ [![npm][npm]][npm-url] [![Build and Deploy Docs](https://github.com/caijf/ut2/actions/workflows/ci.yml/badge.svg)](https://github.com/caijf/ut2/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/caijf/ut2/branch/main/graph/badge.svg?token=XKTS0H7085)](https://codecov.io/gh/caijf/ut2) [![Static Badge](https://img.shields.io/badge/benchmark-online-green)](https://codesandbox.io/s/github/caijf/ut2/tree/main/benchmark) ![npm](https://img.shields.io/npm/dt/ut2) ![GitHub](https://img.shields.io/github/license/caijf/ut2.svg)
6
6
 
7
7
  ## 比较
8
8
 
package/dist/ut2.js CHANGED
@@ -403,6 +403,10 @@
403
403
  return result;
404
404
  }
405
405
 
406
+ function isNil(value) {
407
+ return value == null;
408
+ }
409
+
406
410
  var symbolToString = symbolProto ? symbolProto.toString : undefined;
407
411
  function baseToString(value) {
408
412
  if (typeof value === 'string') {
@@ -418,7 +422,7 @@
418
422
  return result === '0' && 1 / value === -Infinity ? '-0' : result;
419
423
  }
420
424
  function toString(value) {
421
- return value == null ? '' : baseToString(value);
425
+ return isNil(value) ? '' : baseToString(value);
422
426
  }
423
427
 
424
428
  function compareAsc(value, other) {
@@ -495,7 +499,7 @@
495
499
  return value == null || value !== value ? defaultValue : value;
496
500
  }
497
501
 
498
- var VERSION = "1.5.3";
502
+ var VERSION = "1.5.5";
499
503
  var supportedArgumentsType = getTag((function () { return arguments; })()) === argumentsTag;
500
504
  var FUNC_ERROR_TEXT = 'Expected a function';
501
505
  function toSource(func) {
@@ -823,7 +827,7 @@
823
827
  }
824
828
 
825
829
  function isEmpty(value) {
826
- if (value == null) {
830
+ if (isNil(value)) {
827
831
  return true;
828
832
  }
829
833
  var tag = getTag(value);
@@ -853,10 +857,6 @@
853
857
  return objectKeys(object).concat(getSymbols(object));
854
858
  }
855
859
 
856
- function isNil(value) {
857
- return value == null;
858
- }
859
-
860
860
  function isTypedArray(value) {
861
861
  if (nodeIsTypedArray) {
862
862
  return nodeIsTypedArray(value);
@@ -1033,6 +1033,7 @@
1033
1033
  otherStack.pop();
1034
1034
  return result;
1035
1035
  }
1036
+
1036
1037
  function isEqual(value, other, customizer, strictCheck) {
1037
1038
  if (strictCheck === void 0) { strictCheck = false; }
1038
1039
  if (typeof customizer === 'function') {
@@ -1078,8 +1079,7 @@
1078
1079
  function isDeepComparable(object, source) {
1079
1080
  return getTag(object) === objectTag && getTag(source) === objectTag;
1080
1081
  }
1081
- function baseIsMatch(object, source, customizer, strictCheck, objStack, srcStack, executedCustomizer) {
1082
- if (executedCustomizer === void 0) { executedCustomizer = false; }
1082
+ function baseIsMatch(object, source, customizer, strictCheck, objStack, srcStack) {
1083
1083
  var hasCustomizer = typeof customizer === 'function';
1084
1084
  if (isDeepComparable(object, source)) {
1085
1085
  objStack = objStack || [];
@@ -1108,7 +1108,7 @@
1108
1108
  continue;
1109
1109
  }
1110
1110
  }
1111
- if (!baseIsMatch(object[key], source[key], customizer, strictCheck, objStack, srcStack, true)) {
1111
+ if (!baseIsMatch(object[key], source[key], customizer, strictCheck, objStack, srcStack)) {
1112
1112
  return false;
1113
1113
  }
1114
1114
  }
@@ -1116,18 +1116,17 @@
1116
1116
  srcStack.pop();
1117
1117
  return true;
1118
1118
  }
1119
- var result = isEqual(object, source, function (objValue, srcValue, k, obj, src) {
1120
- if (!executedCustomizer && hasCustomizer) {
1119
+ var result = isEqualDeep(object, source, function (objValue, srcValue, k, obj, src) {
1120
+ if (hasCustomizer) {
1121
1121
  var compared = customizer(objValue, srcValue, k, obj, src, objStack, srcStack);
1122
1122
  if (compared !== undefined) {
1123
1123
  return compared;
1124
1124
  }
1125
1125
  }
1126
- executedCustomizer = false;
1127
1126
  if (isDeepComparable(objValue, srcValue)) {
1128
1127
  return baseIsMatch(objValue, srcValue, customizer, strictCheck, objStack, srcStack);
1129
1128
  }
1130
- }, strictCheck);
1129
+ }, strictCheck, objStack, srcStack);
1131
1130
  return result;
1132
1131
  }
1133
1132
  function isMatch(object, source, customizer, strictCheck) {
@@ -1138,7 +1137,7 @@
1138
1137
  return !!compared;
1139
1138
  }
1140
1139
  }
1141
- return baseIsMatch(object, source, customizer, strictCheck, undefined, undefined, true);
1140
+ return baseIsMatch(object, source, customizer, strictCheck, undefined, undefined);
1142
1141
  }
1143
1142
 
1144
1143
  function isNumber(value) {
@@ -1399,7 +1398,7 @@
1399
1398
  function pickBy(object, predicate) {
1400
1399
  if (predicate === void 0) { predicate = stubFlase; }
1401
1400
  var result = {};
1402
- if (object === null) {
1401
+ if (isNil(object)) {
1403
1402
  return result;
1404
1403
  }
1405
1404
  var keys = allKeysIn(object);
@@ -1526,7 +1525,7 @@
1526
1525
  function conformsTo(object, source) {
1527
1526
  var props = allKeys(source);
1528
1527
  var length = props.length;
1529
- if (object == null) {
1528
+ if (isNil(object)) {
1530
1529
  return !length;
1531
1530
  }
1532
1531
  if (length === 0) {