ut2 1.5.4 → 1.5.6

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) [![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)
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://s57jpy.csb.app/) ![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.4";
502
+ var VERSION = "1.5.6";
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);
@@ -1351,17 +1351,17 @@
1351
1351
  if (newValue === undefined) {
1352
1352
  newValue = srcValue;
1353
1353
  }
1354
- if (isObjectLike(newValue) && key in obj && !storage.has(newValue)) {
1354
+ if (isObjectLike(newValue) && !storage.has(newValue)) {
1355
1355
  storage.set(newValue, true);
1356
1356
  var objValue = obj[key];
1357
1357
  var newObjValue = void 0;
1358
1358
  if (isArray(newValue)) {
1359
1359
  newObjValue = isArray(objValue) ? objValue : [];
1360
1360
  }
1361
- else {
1362
- newObjValue = isObjectLike(objValue) ? objValue : {};
1361
+ else if (isPlainObject(newValue)) {
1362
+ newObjValue = isPlainObject(objValue) ? objValue : {};
1363
1363
  }
1364
- obj[key] = baseMerge(newObjValue, newValue, customizer, storage);
1364
+ obj[key] = newObjValue ? baseMerge(newObjValue, newValue, customizer, storage) : newValue;
1365
1365
  }
1366
1366
  else {
1367
1367
  if (newValue !== undefined || (newValue === undefined && !(key in obj))) {
@@ -1398,7 +1398,7 @@
1398
1398
  function pickBy(object, predicate) {
1399
1399
  if (predicate === void 0) { predicate = stubFlase; }
1400
1400
  var result = {};
1401
- if (object === null) {
1401
+ if (isNil(object)) {
1402
1402
  return result;
1403
1403
  }
1404
1404
  var keys = allKeysIn(object);
@@ -1525,7 +1525,7 @@
1525
1525
  function conformsTo(object, source) {
1526
1526
  var props = allKeys(source);
1527
1527
  var length = props.length;
1528
- if (object == null) {
1528
+ if (isNil(object)) {
1529
1529
  return !length;
1530
1530
  }
1531
1531
  if (length === 0) {