ut2 1.9.5 → 1.10.1

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
@@ -66,6 +66,7 @@ const debounced = debounce(() => {
66
66
  - [difference](https://caijf.github.io/ut2/module-Array.html#.difference) - 排除部分值。
67
67
  - [formPairs](https://caijf.github.io/ut2/module-Array.html#.fromPairs) - 将键值对转为对象。
68
68
  - [intersection](https://caijf.github.io/ut2/module-Array.html#.intersection) - 交集去重。
69
+ - [move](https://caijf.github.io/ut2/module-Array.html#.move) - 数组元素移动。
69
70
  - [nth](https://caijf.github.io/ut2/module-Array.html#.nth) - 获取第 `n` 个元素。
70
71
  - [shuffle](https://caijf.github.io/ut2/module-Array.html#.shuffle) - 打乱数组。
71
72
  - [union](https://caijf.github.io/ut2/module-Array.html#.union) - 并集去重。
@@ -137,6 +138,7 @@ const debounced = debounce(() => {
137
138
  - [isUndefined](https://caijf.github.io/ut2/module-Language.html#.isUndefined) - `undefined` 。
138
139
  - [isWeakMap](https://caijf.github.io/ut2/module-Language.html#.isWeakMap) - `WeakMap` 对象。
139
140
  - [isWeakSet](https://caijf.github.io/ut2/module-Language.html#.isWeakSet) - `WeakSet` 对象。
141
+ - [isWindow](https://caijf.github.io/ut2/module-Language.html#.isWindow) - `Window` 对象。
140
142
  - [Math](https://caijf.github.io/ut2/module-Math.html) 数学
141
143
  - [ceil](https://caijf.github.io/ut2/module-Math.html#.ceil) - 向上舍入。
142
144
  - [floor](https://caijf.github.io/ut2/module-Math.html#.floor) - 向下舍入。
@@ -197,6 +199,13 @@ const debounced = debounce(() => {
197
199
  - [toSafeInteger](https://caijf.github.io/ut2/module-Util.html#.toSafeInteger) - 转为安全整数。
198
200
  - [toString](https://caijf.github.io/ut2/module-Util.html#.toString) - 转为字符串。
199
201
  - [uniqueId](https://caijf.github.io/ut2/module-Util.html#.uniqueId) - 唯一 ID。
202
+ - [GLOBAL](https://caijf.github.io/ut2/global.html) 其他导出的成员
203
+ - [MAX_ARRAY_LENGTH](https://caijf.github.io/ut2/global.html#MAX_ARRAY_LENGTH) - 最大数组长度。
204
+ - [MAX_SAFE_INTEGER](https://caijf.github.io/ut2/global.html#MAX_SAFE_INTEGER) - 最大安全整数。
205
+ - [MIN_SAFE_INTEGER](https://caijf.github.io/ut2/global.html#MIN_SAFE_INTEGER) - 最小安全整数。
206
+ - [VERSION](https://caijf.github.io/ut2/global.html#VERSION) - 当前版本号。
207
+ - [isBrowser](https://caijf.github.io/ut2/global.html#isBrowser) - 当前运行环境是否为浏览器。
208
+ - [root](https://caijf.github.io/ut2/global.html#root) - 全局对象。
200
209
 
201
210
  [npm]: https://img.shields.io/npm/v/ut2.svg
202
211
  [npm-url]: https://npmjs.com/package/ut2
package/dist/ut2.js CHANGED
@@ -56,6 +56,7 @@
56
56
  var promiseTag = '[object Promise]';
57
57
  var setTag = '[object Set]';
58
58
  var weakMapTag = '[object WeakMap]';
59
+ var windowTag = '[object Window]';
59
60
 
60
61
  function isArray(value) {
61
62
  return Array.isArray(value);
@@ -207,6 +208,11 @@
207
208
  });
208
209
  }
209
210
 
211
+ function move(arr, from, to) {
212
+ arr.splice(to, 0, arr.splice(from, 1)[0]);
213
+ return arr;
214
+ }
215
+
210
216
  function isFunction(value) {
211
217
  if (typeof value === 'function') {
212
218
  return true;
@@ -599,7 +605,8 @@
599
605
  return value == null || value !== value ? defaultValue : value;
600
606
  };
601
607
 
602
- var VERSION = "1.9.5";
608
+ var VERSION = "1.10.1";
609
+ var isBrowser = typeof window !== stringUndefined && isObjectLike(window) && typeof document !== stringUndefined && isObjectLike(document) && window.document === document;
603
610
  var supportedArgumentsType = getTag((function () { return arguments; })()) === argumentsTag;
604
611
  var FUNC_ERROR_TEXT = 'Expected a function';
605
612
  function toSource(func) {
@@ -1268,6 +1275,10 @@
1268
1275
  return getTag(value) === weakSetTag;
1269
1276
  }
1270
1277
 
1278
+ function isWindow(value) {
1279
+ return isObjectLike(value) && getTag(value) === windowTag;
1280
+ }
1281
+
1271
1282
  function decimalAdjust(type, value, precision) {
1272
1283
  if (precision === void 0) { precision = 0; }
1273
1284
  var func = Math[type];
@@ -1487,6 +1498,7 @@
1487
1498
  if (getKeys === void 0) { getKeys = allKeys; }
1488
1499
  return baseMerge(object, source, getKeys, customizer);
1489
1500
  }
1501
+ merge.NOT_MERGE_ARRAYS = function (objValue, srcValue) { return (isArray(srcValue) ? srcValue : undefined); };
1490
1502
 
1491
1503
  function castArray(value) {
1492
1504
  if (!arguments.length) {
@@ -1809,6 +1821,7 @@
1809
1821
  exports.isBigInt = isBigInt;
1810
1822
  exports.isBlob = isBlob;
1811
1823
  exports.isBoolean = isBoolean;
1824
+ exports.isBrowser = isBrowser;
1812
1825
  exports.isBuffer = isBuffer;
1813
1826
  exports.isDataView = isDataView;
1814
1827
  exports.isDate = isDate;
@@ -1839,6 +1852,7 @@
1839
1852
  exports.isUndefined = isUndefined;
1840
1853
  exports.isWeakMap = isWeakMap;
1841
1854
  exports.isWeakSet = isWeakSet;
1855
+ exports.isWindow = isWindow;
1842
1856
  exports.kebabCase = kebabCase;
1843
1857
  exports.keyBy = keyBy;
1844
1858
  exports.keys = keys;
@@ -1851,6 +1865,7 @@
1851
1865
  exports.max = max;
1852
1866
  exports.merge = merge;
1853
1867
  exports.min = min;
1868
+ exports.move = move;
1854
1869
  exports.negate = negate;
1855
1870
  exports.noop = noop;
1856
1871
  exports.nth = nth;
@@ -1869,6 +1884,7 @@
1869
1884
  exports.range = range;
1870
1885
  exports.reduce = reduce;
1871
1886
  exports.reduceRight = reduceRight;
1887
+ exports.root = root;
1872
1888
  exports.round = round;
1873
1889
  exports.shuffle = shuffle;
1874
1890
  exports.sleep = sleep;