@antv/util
Advanced tools
Comparing version 1.0.12 to 1.1.0
@@ -73,3 +73,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 25); | ||
/******/ return __webpack_require__(__webpack_require__.s = 30); | ||
/******/ }) | ||
@@ -81,17 +81,5 @@ /************************************************************************/ | ||
var isType = __webpack_require__(3); | ||
var isObject = __webpack_require__(14); | ||
var isArray = __webpack_require__(1); | ||
var isArray = Array.isArray ? Array.isArray : function (value) { | ||
return isType(value, 'Array'); | ||
}; | ||
module.exports = isArray; | ||
/***/ }), | ||
/* 1 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isObject = __webpack_require__(13); | ||
var isArray = __webpack_require__(0); | ||
var each = function each(elements, func) { | ||
@@ -124,2 +112,14 @@ if (!elements) { | ||
/***/ }), | ||
/* 1 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isType = __webpack_require__(4); | ||
var isArray = Array.isArray ? Array.isArray : function (value) { | ||
return isType(value, 'Array'); | ||
}; | ||
module.exports = isArray; | ||
/***/ }), | ||
/* 2 */ | ||
@@ -142,2 +142,19 @@ /***/ (function(module, exports) { | ||
/* 3 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
/** | ||
* 是否为函数 | ||
* @param {*} fn 对象 | ||
* @return {Boolean} 是否函数 | ||
*/ | ||
var isType = __webpack_require__(4); | ||
var isFunction = function isFunction(value) { | ||
return isType(value, 'Function'); | ||
}; | ||
module.exports = isFunction; | ||
/***/ }), | ||
/* 4 */ | ||
/***/ (function(module, exports) { | ||
@@ -153,3 +170,3 @@ | ||
/***/ }), | ||
/* 4 */ | ||
/* 5 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -161,3 +178,3 @@ | ||
*/ | ||
var isType = __webpack_require__(3); | ||
var isType = __webpack_require__(4); | ||
@@ -170,20 +187,32 @@ var isNumber = function isNumber(value) { | ||
/***/ }), | ||
/* 5 */ | ||
/* 6 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
/** | ||
* 是否为函数 | ||
* @param {*} fn 对象 | ||
* @return {Boolean} 是否函数 | ||
*/ | ||
var isType = __webpack_require__(3); | ||
var isObjectLike = __webpack_require__(11); | ||
var isType = __webpack_require__(4); | ||
var isFunction = function isFunction(value) { | ||
return isType(value, 'Function'); | ||
var isPlainObject = function isPlainObject(value) { | ||
/** | ||
* isObjectLike(new Foo) => false | ||
* isObjectLike([1, 2, 3]) => false | ||
* isObjectLike({ x: 0, y: 0 }) => true | ||
* isObjectLike(Object.create(null)) => true | ||
*/ | ||
if (!isObjectLike(value) || !isType(value, 'Object')) { | ||
return false; | ||
} | ||
if (Object.getPrototypeOf(value) === null) { | ||
return true; | ||
} | ||
var proto = value; | ||
while (Object.getPrototypeOf(proto) !== null) { | ||
proto = Object.getPrototypeOf(proto); | ||
} | ||
return Object.getPrototypeOf(value) === proto; | ||
}; | ||
module.exports = isFunction; | ||
module.exports = isPlainObject; | ||
/***/ }), | ||
/* 6 */ | ||
/* 7 */ | ||
/***/ (function(module, exports) { | ||
@@ -203,6 +232,6 @@ | ||
/***/ }), | ||
/* 7 */ | ||
/* 8 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isNil = __webpack_require__(6); | ||
var isNil = __webpack_require__(7); | ||
@@ -217,32 +246,42 @@ function toString(value) { | ||
/***/ }), | ||
/* 8 */ | ||
/* 9 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isObjectLike = __webpack_require__(9); | ||
var isType = __webpack_require__(3); | ||
var isArrayLike = __webpack_require__(2); | ||
var isPlainObject = function isPlainObject(value) { | ||
/** | ||
* isObjectLike(new Foo) => false | ||
* isObjectLike([1, 2, 3]) => false | ||
* isObjectLike({ x: 0, y: 0 }) => true | ||
* isObjectLike(Object.create(null)) => true | ||
*/ | ||
if (!isObjectLike(value) || !isType(value, 'Object')) { | ||
var indexOf = Array.prototype.indexOf; | ||
var contains = function contains(arr, value) { | ||
if (!isArrayLike(arr)) { | ||
return false; | ||
} | ||
if (Object.getPrototypeOf(value) === null) { | ||
return true; | ||
return indexOf.call(arr, value) > -1; | ||
}; | ||
module.exports = contains; | ||
/***/ }), | ||
/* 10 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var each = __webpack_require__(0); | ||
var isArrayLike = __webpack_require__(2); | ||
var filter = function filter(arr, func) { | ||
if (!isArrayLike(arr)) { | ||
return arr; | ||
} | ||
var proto = value; | ||
while (Object.getPrototypeOf(proto) !== null) { | ||
proto = Object.getPrototypeOf(proto); | ||
} | ||
return Object.getPrototypeOf(value) === proto; | ||
var result = []; | ||
each(arr, function (value, index) { | ||
if (func(value, index)) { | ||
result.push(value); | ||
} | ||
}); | ||
return result; | ||
}; | ||
module.exports = isPlainObject; | ||
module.exports = filter; | ||
/***/ }), | ||
/* 9 */ | ||
/* 11 */ | ||
/***/ (function(module, exports) { | ||
@@ -265,3 +304,3 @@ | ||
/***/ }), | ||
/* 10 */ | ||
/* 12 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -278,3 +317,3 @@ | ||
/***/ }), | ||
/* 11 */ | ||
/* 13 */ | ||
/***/ (function(module, exports) { | ||
@@ -300,20 +339,3 @@ | ||
/***/ }), | ||
/* 12 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isArrayLike = __webpack_require__(2); | ||
var indexOf = Array.prototype.indexOf; | ||
var contains = function contains(arr, value) { | ||
if (!isArrayLike(arr)) { | ||
return false; | ||
} | ||
return indexOf.call(arr, value) > -1; | ||
}; | ||
module.exports = contains; | ||
/***/ }), | ||
/* 13 */ | ||
/* 14 */ | ||
/***/ (function(module, exports) { | ||
@@ -337,16 +359,37 @@ | ||
/***/ }), | ||
/* 14 */ | ||
/* 15 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var each = __webpack_require__(1); | ||
var isArrayLike = __webpack_require__(2); | ||
var keys = __webpack_require__(16); | ||
var isNil = __webpack_require__(7); | ||
var filter = function filter(arr, func) { | ||
if (!isArrayLike(arr)) { | ||
return arr; | ||
function isMatch(obj, attrs) { | ||
var _keys = keys(attrs); | ||
var length = _keys.length; | ||
if (isNil(obj)) return !length; | ||
for (var i = 0; i < length; i += 1) { | ||
var key = _keys[i]; | ||
if (attrs[key] !== obj[key] || !(key in obj)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
module.exports = isMatch; | ||
/***/ }), | ||
/* 16 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var each = __webpack_require__(0); | ||
var isFunction = __webpack_require__(3); | ||
var keys = Object.keys ? function (obj) { | ||
return Object.keys(obj); | ||
} : function (obj) { | ||
var result = []; | ||
each(arr, function (value, index) { | ||
if (func(value, index)) { | ||
result.push(value); | ||
each(obj, function (value, key) { | ||
if (!(isFunction(obj) && key === 'prototype')) { | ||
result.push(key); | ||
} | ||
@@ -357,6 +400,6 @@ }); | ||
module.exports = filter; | ||
module.exports = keys; | ||
/***/ }), | ||
/* 15 */ | ||
/* 17 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -389,3 +432,22 @@ | ||
/***/ }), | ||
/* 16 */ | ||
/* 18 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var each = __webpack_require__(0); | ||
var contains = __webpack_require__(9); | ||
var uniq = function uniq(arr) { | ||
var resultArr = []; | ||
each(arr, function (item) { | ||
if (!contains(resultArr, item)) { | ||
resultArr.push(item); | ||
} | ||
}); | ||
return resultArr; | ||
}; | ||
module.exports = uniq; | ||
/***/ }), | ||
/* 19 */ | ||
/***/ (function(module, exports) { | ||
@@ -396,7 +458,37 @@ | ||
/***/ }), | ||
/* 17 */ | ||
/* 20 */ | ||
/***/ (function(module, exports) { | ||
module.exports = function (obj, key) { | ||
return obj.hasOwnProperty(key); | ||
}; | ||
/***/ }), | ||
/* 21 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var toString = __webpack_require__(7); | ||
var each = __webpack_require__(0); | ||
var isFunction = __webpack_require__(3); | ||
var values = Object.values ? function (obj) { | ||
return Object.values(obj); | ||
} : function (obj) { | ||
var result = []; | ||
each(obj, function (value, key) { | ||
if (!(isFunction(obj) && key === 'prototype')) { | ||
result.push(value); | ||
} | ||
}); | ||
return result; | ||
}; | ||
module.exports = values; | ||
/***/ }), | ||
/* 22 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var toString = __webpack_require__(8); | ||
var lowerCase = function lowerCase(str) { | ||
@@ -409,6 +501,6 @@ return toString(str).toLowerCase(); | ||
/***/ }), | ||
/* 18 */ | ||
/* 23 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var toString = __webpack_require__(7); | ||
var toString = __webpack_require__(8); | ||
@@ -422,3 +514,3 @@ var upperCase = function upperCase(str) { | ||
/***/ }), | ||
/* 19 */ | ||
/* 24 */ | ||
/***/ (function(module, exports) { | ||
@@ -435,3 +527,3 @@ | ||
/***/ }), | ||
/* 20 */ | ||
/* 25 */ | ||
/***/ (function(module, exports) { | ||
@@ -449,6 +541,6 @@ | ||
/***/ }), | ||
/* 21 */ | ||
/* 26 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isType = __webpack_require__(3); | ||
var isType = __webpack_require__(4); | ||
@@ -462,8 +554,8 @@ var isString = function isString(str) { | ||
/***/ }), | ||
/* 22 */ | ||
/* 27 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isFunction = __webpack_require__(5); | ||
var isArray = __webpack_require__(0); | ||
var groupBy = __webpack_require__(23); | ||
var isFunction = __webpack_require__(3); | ||
var isArray = __webpack_require__(1); | ||
var groupBy = __webpack_require__(28); | ||
@@ -493,7 +585,7 @@ var groupToMap = function groupToMap(data, condition) { | ||
/***/ }), | ||
/* 23 */ | ||
/* 28 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var each = __webpack_require__(1); | ||
var isArray = __webpack_require__(0); | ||
var each = __webpack_require__(0); | ||
var isArray = __webpack_require__(1); | ||
var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
@@ -520,8 +612,8 @@ var groupBy = function groupBy(data, condition) { | ||
/***/ }), | ||
/* 24 */ | ||
/* 29 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isObjectLike = __webpack_require__(9); | ||
var isObjectLike = __webpack_require__(11); | ||
var isArrayLike = __webpack_require__(2); | ||
var isString = __webpack_require__(21); | ||
var isString = __webpack_require__(26); | ||
@@ -572,13 +664,14 @@ var isEqual = function isEqual(value, other) { | ||
/***/ }), | ||
/* 25 */ | ||
/* 30 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var arrayUtil = __webpack_require__(26); | ||
var eventUtil = __webpack_require__(37); | ||
var mathUtil = __webpack_require__(40); | ||
var stringUtil = __webpack_require__(55); | ||
var typeUtil = __webpack_require__(61); | ||
var each = __webpack_require__(1); | ||
var mix = __webpack_require__(11); | ||
var arrayUtil = __webpack_require__(31); | ||
var eventUtil = __webpack_require__(43); | ||
var mathUtil = __webpack_require__(46); | ||
var objectUtil = __webpack_require__(61); | ||
var stringUtil = __webpack_require__(65); | ||
var typeUtil = __webpack_require__(71); | ||
var each = __webpack_require__(0); | ||
var mix = __webpack_require__(13); | ||
@@ -590,27 +683,28 @@ var util = { | ||
mathUtil: mathUtil, | ||
objectUtil: objectUtil, | ||
stringUtil: stringUtil, | ||
typeUtil: typeUtil, | ||
// others | ||
augment: __webpack_require__(66), | ||
clone: __webpack_require__(67), | ||
deepMix: __webpack_require__(68), | ||
augment: __webpack_require__(76), | ||
clone: __webpack_require__(77), | ||
deepMix: __webpack_require__(78), | ||
each: each, | ||
extend: __webpack_require__(69), | ||
filter: __webpack_require__(14), | ||
group: __webpack_require__(70), | ||
groupBy: __webpack_require__(23), | ||
groupToMap: __webpack_require__(22), | ||
indexOf: __webpack_require__(71), | ||
isEmpty: __webpack_require__(72), | ||
isEqual: __webpack_require__(24), | ||
isEqualWith: __webpack_require__(73), | ||
map: __webpack_require__(74), | ||
extend: __webpack_require__(79), | ||
filter: __webpack_require__(10), | ||
group: __webpack_require__(80), | ||
groupBy: __webpack_require__(28), | ||
groupToMap: __webpack_require__(27), | ||
indexOf: __webpack_require__(81), | ||
isEmpty: __webpack_require__(82), | ||
isEqual: __webpack_require__(29), | ||
isEqualWith: __webpack_require__(83), | ||
map: __webpack_require__(84), | ||
mix: mix, | ||
pick: __webpack_require__(75), | ||
toArray: __webpack_require__(10), | ||
toString: __webpack_require__(7), | ||
uniqueId: __webpack_require__(76) | ||
pick: __webpack_require__(85), | ||
toArray: __webpack_require__(12), | ||
toString: __webpack_require__(8), | ||
uniqueId: __webpack_require__(86) | ||
}; | ||
each([arrayUtil, eventUtil, mathUtil, stringUtil, typeUtil], function (collection) { | ||
each([arrayUtil, eventUtil, mathUtil, objectUtil, stringUtil, typeUtil], function (collection) { | ||
mix(util, collection); | ||
@@ -622,27 +716,85 @@ }); | ||
/***/ }), | ||
/* 26 */ | ||
/* 31 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
module.exports = { | ||
contains: __webpack_require__(12), | ||
firstValue: __webpack_require__(27), | ||
flatten: __webpack_require__(28), | ||
getRange: __webpack_require__(29), | ||
merge: __webpack_require__(30), | ||
pull: __webpack_require__(31), | ||
pullAt: __webpack_require__(15), | ||
reduce: __webpack_require__(32), | ||
remove: __webpack_require__(33), | ||
union: __webpack_require__(34), | ||
uniq: __webpack_require__(35), | ||
values: __webpack_require__(36) | ||
contains: __webpack_require__(9), | ||
difference: __webpack_require__(32), | ||
find: __webpack_require__(33), | ||
firstValue: __webpack_require__(34), | ||
flatten: __webpack_require__(35), | ||
flattenDeep: __webpack_require__(36), | ||
getRange: __webpack_require__(37), | ||
merge: __webpack_require__(38), | ||
pull: __webpack_require__(39), | ||
pullAt: __webpack_require__(17), | ||
reduce: __webpack_require__(40), | ||
remove: __webpack_require__(41), | ||
union: __webpack_require__(42), | ||
uniq: __webpack_require__(18) | ||
}; | ||
/***/ }), | ||
/* 27 */ | ||
/* 32 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isNil = __webpack_require__(6); | ||
var isArray = __webpack_require__(0); | ||
var filter = __webpack_require__(10); | ||
var contains = __webpack_require__(9); | ||
/** | ||
* Flattens `array` a single level deep. | ||
* | ||
* @param {Array} arr The array to inspect. | ||
* @param {Array} values The values to exclude. | ||
* @return {Array} Returns the new array of filtered values. | ||
* @example | ||
* difference([2, 1], [2, 3]); // => [1] | ||
*/ | ||
var difference = function difference(arr) { | ||
var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
return filter(arr, function (value) { | ||
return !contains(values, value); | ||
}); | ||
}; | ||
module.exports = difference; | ||
/***/ }), | ||
/* 33 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isFunction = __webpack_require__(3); | ||
var isPlainObject = __webpack_require__(6); | ||
var isMatch = __webpack_require__(15); | ||
function find(arr, predicate) { | ||
var _predicate = void 0; | ||
if (isFunction(predicate)) { | ||
_predicate = predicate; | ||
} | ||
if (isPlainObject(predicate)) { | ||
_predicate = function _predicate(a) { | ||
return isMatch(a, predicate); | ||
}; | ||
} | ||
if (_predicate) { | ||
for (var i = 0; i < arr.length; i += 1) { | ||
if (_predicate(arr[i])) { | ||
return arr[i]; | ||
} | ||
} | ||
} | ||
return null; | ||
} | ||
module.exports = find; | ||
/***/ }), | ||
/* 34 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isNil = __webpack_require__(7); | ||
var isArray = __webpack_require__(1); | ||
var firstValue = function firstValue(data, name) { | ||
@@ -668,7 +820,7 @@ var rst = null; | ||
/***/ }), | ||
/* 28 */ | ||
/* 35 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isArray = __webpack_require__(0); | ||
var each = __webpack_require__(1); | ||
var isArray = __webpack_require__(1); | ||
var each = __webpack_require__(0); | ||
@@ -682,3 +834,3 @@ /** | ||
* | ||
* _.flatten([1, [2, [3, [4]], 5]]); // => [1, 2, [3, [4]], 5] | ||
* flatten([1, [2, [3, [4]], 5]]); // => [1, 2, [3, [4]], 5] | ||
*/ | ||
@@ -705,8 +857,39 @@ var flatten = function flatten(arr) { | ||
/***/ }), | ||
/* 29 */ | ||
/* 36 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var filter = __webpack_require__(14); | ||
var isArray = __webpack_require__(0); | ||
var isArray = __webpack_require__(1); | ||
/** | ||
* Flattens `array` a single level deep. | ||
* | ||
* @param {Array} arr The array to flatten. | ||
* @param {Array} result The array to return. | ||
* @return {Array} Returns the new flattened array. | ||
* @example | ||
* | ||
* flattenDeep([1, [2, [3, [4]], 5]]); // => [1, 2, 3, 4, 5] | ||
*/ | ||
var flattenDeep = function flattenDeep(arr) { | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
if (!isArray(arr)) { | ||
result.push(arr); | ||
} else { | ||
for (var i = 0; i < arr.length; i += 1) { | ||
flattenDeep(arr[i], result); | ||
} | ||
} | ||
return result; | ||
}; | ||
module.exports = flattenDeep; | ||
/***/ }), | ||
/* 37 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var filter = __webpack_require__(10); | ||
var isArray = __webpack_require__(1); | ||
var getRange = function getRange(values) { | ||
@@ -742,3 +925,3 @@ // 存在 NaN 时,min,max 判定会出问题 | ||
/***/ }), | ||
/* 30 */ | ||
/* 38 */ | ||
/***/ (function(module, exports) { | ||
@@ -757,3 +940,3 @@ | ||
/***/ }), | ||
/* 31 */ | ||
/* 39 */ | ||
/***/ (function(module, exports) { | ||
@@ -781,8 +964,8 @@ | ||
/***/ }), | ||
/* 32 */ | ||
/* 40 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isArray = __webpack_require__(0); | ||
var isPlainObject = __webpack_require__(8); | ||
var each = __webpack_require__(1); | ||
var isArray = __webpack_require__(1); | ||
var isPlainObject = __webpack_require__(6); | ||
var each = __webpack_require__(0); | ||
@@ -803,7 +986,7 @@ var reduce = function reduce(arr, fn, init) { | ||
/***/ }), | ||
/* 33 */ | ||
/* 41 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isArrayLike = __webpack_require__(2); | ||
var pullAt = __webpack_require__(15); | ||
var pullAt = __webpack_require__(17); | ||
@@ -839,18 +1022,16 @@ var remove = function remove(arr, predicate) { | ||
/***/ }), | ||
/* 34 */ | ||
/* 42 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var each = __webpack_require__(1); | ||
var toArray = __webpack_require__(10); | ||
var each = __webpack_require__(0); | ||
var toArray = __webpack_require__(12); | ||
var uniq = __webpack_require__(18); | ||
var union = function union() { | ||
var result = new Set(); | ||
var values = []; | ||
each(arguments, function (arg) { | ||
values = toArray(arg); | ||
each(values, function (val) { | ||
result.add(val); | ||
}); | ||
var result = []; | ||
var sources = toArray(arguments); | ||
each(sources, function (arr) { | ||
result = result.concat(arr); | ||
}); | ||
return Array.from(result); | ||
return uniq(result); | ||
}; | ||
@@ -861,62 +1042,13 @@ | ||
/***/ }), | ||
/* 35 */ | ||
/* 43 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var contains = __webpack_require__(12); | ||
var uniq = function uniq(arr) { | ||
var resultArr = []; | ||
arr.forEach(function (item) { | ||
if (!contains(resultArr, item)) { | ||
resultArr.push(item); | ||
} | ||
}); | ||
return resultArr; | ||
}; | ||
module.exports = uniq; | ||
/***/ }), | ||
/* 36 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var each = __webpack_require__(1); | ||
var isNil = __webpack_require__(6); | ||
var isArray = __webpack_require__(0); | ||
var values = function values(data, name) { | ||
var rst = []; | ||
var tmpMap = {}; | ||
for (var i = 0; i < data.length; i++) { | ||
var obj = data[i]; | ||
var value = obj[name]; | ||
if (!isNil(value)) { | ||
if (!isArray(value)) { | ||
value = [value]; | ||
} | ||
each(value, function (val) { | ||
if (!tmpMap[val]) { | ||
rst.push(val); | ||
tmpMap[val] = true; | ||
} | ||
}); | ||
} | ||
} | ||
return rst; | ||
}; | ||
module.exports = values; | ||
/***/ }), | ||
/* 37 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
module.exports = { | ||
getWrapBehavior: __webpack_require__(38), | ||
wrapBehavior: __webpack_require__(39) | ||
getWrapBehavior: __webpack_require__(44), | ||
wrapBehavior: __webpack_require__(45) | ||
}; | ||
/***/ }), | ||
/* 38 */ | ||
/* 44 */ | ||
/***/ (function(module, exports) { | ||
@@ -938,3 +1070,3 @@ | ||
/***/ }), | ||
/* 39 */ | ||
/* 45 */ | ||
/***/ (function(module, exports) { | ||
@@ -963,26 +1095,26 @@ | ||
/***/ }), | ||
/* 40 */ | ||
/* 46 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
module.exports = { | ||
clamp: __webpack_require__(41), | ||
fixedBase: __webpack_require__(42), | ||
isDecimal: __webpack_require__(43), | ||
isEven: __webpack_require__(44), | ||
isInteger: __webpack_require__(45), | ||
isNegative: __webpack_require__(46), | ||
isNumberEqual: __webpack_require__(47), | ||
isOdd: __webpack_require__(48), | ||
isPositive: __webpack_require__(49), | ||
maxBy: __webpack_require__(50), | ||
minBy: __webpack_require__(51), | ||
mod: __webpack_require__(52), | ||
toDegree: __webpack_require__(53), | ||
toInt: __webpack_require__(16), | ||
toInteger: __webpack_require__(16), | ||
toRadian: __webpack_require__(54) | ||
clamp: __webpack_require__(47), | ||
fixedBase: __webpack_require__(48), | ||
isDecimal: __webpack_require__(49), | ||
isEven: __webpack_require__(50), | ||
isInteger: __webpack_require__(51), | ||
isNegative: __webpack_require__(52), | ||
isNumberEqual: __webpack_require__(53), | ||
isOdd: __webpack_require__(54), | ||
isPositive: __webpack_require__(55), | ||
maxBy: __webpack_require__(56), | ||
minBy: __webpack_require__(57), | ||
mod: __webpack_require__(58), | ||
toDegree: __webpack_require__(59), | ||
toInt: __webpack_require__(19), | ||
toInteger: __webpack_require__(19), | ||
toRadian: __webpack_require__(60) | ||
}; | ||
/***/ }), | ||
/* 41 */ | ||
/* 47 */ | ||
/***/ (function(module, exports) { | ||
@@ -1002,3 +1134,3 @@ | ||
/***/ }), | ||
/* 42 */ | ||
/* 48 */ | ||
/***/ (function(module, exports) { | ||
@@ -1022,6 +1154,6 @@ | ||
/***/ }), | ||
/* 43 */ | ||
/* 49 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isNumber = __webpack_require__(4); | ||
var isNumber = __webpack_require__(5); | ||
@@ -1035,6 +1167,6 @@ var isDecimal = function isDecimal(num) { | ||
/***/ }), | ||
/* 44 */ | ||
/* 50 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isNumber = __webpack_require__(4); | ||
var isNumber = __webpack_require__(5); | ||
@@ -1048,6 +1180,6 @@ var isEven = function isEven(num) { | ||
/***/ }), | ||
/* 45 */ | ||
/* 51 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isNumber = __webpack_require__(4); | ||
var isNumber = __webpack_require__(5); | ||
@@ -1061,6 +1193,6 @@ var isInteger = Number.isInteger ? Number.isInteger : function (num) { | ||
/***/ }), | ||
/* 46 */ | ||
/* 52 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isNumber = __webpack_require__(4); | ||
var isNumber = __webpack_require__(5); | ||
@@ -1074,3 +1206,3 @@ var isNagative = function isNagative(num) { | ||
/***/ }), | ||
/* 47 */ | ||
/* 53 */ | ||
/***/ (function(module, exports) { | ||
@@ -1087,6 +1219,6 @@ | ||
/***/ }), | ||
/* 48 */ | ||
/* 54 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isNumber = __webpack_require__(4); | ||
var isNumber = __webpack_require__(5); | ||
@@ -1100,6 +1232,6 @@ var isOdd = function isOdd(num) { | ||
/***/ }), | ||
/* 49 */ | ||
/* 55 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isNumber = __webpack_require__(4); | ||
var isNumber = __webpack_require__(5); | ||
@@ -1113,8 +1245,8 @@ var isPositive = function isPositive(num) { | ||
/***/ }), | ||
/* 50 */ | ||
/* 56 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isArray = __webpack_require__(0); | ||
var isFunction = __webpack_require__(5); | ||
var each = __webpack_require__(1); | ||
var isArray = __webpack_require__(1); | ||
var isFunction = __webpack_require__(3); | ||
var each = __webpack_require__(0); | ||
/** | ||
@@ -1163,8 +1295,8 @@ * @param {Array} arr The array to iterate over. | ||
/***/ }), | ||
/* 51 */ | ||
/* 57 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isArray = __webpack_require__(0); | ||
var isFunction = __webpack_require__(5); | ||
var each = __webpack_require__(1); | ||
var isArray = __webpack_require__(1); | ||
var isFunction = __webpack_require__(3); | ||
var each = __webpack_require__(0); | ||
/** | ||
@@ -1213,3 +1345,3 @@ * @param {Array} arr The array to iterate over. | ||
/***/ }), | ||
/* 52 */ | ||
/* 58 */ | ||
/***/ (function(module, exports) { | ||
@@ -1224,3 +1356,3 @@ | ||
/***/ }), | ||
/* 53 */ | ||
/* 59 */ | ||
/***/ (function(module, exports) { | ||
@@ -1237,3 +1369,3 @@ | ||
/***/ }), | ||
/* 54 */ | ||
/* 60 */ | ||
/***/ (function(module, exports) { | ||
@@ -1250,14 +1382,52 @@ | ||
/***/ }), | ||
/* 55 */ | ||
/* 61 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
module.exports = { | ||
forIn: __webpack_require__(62), | ||
has: __webpack_require__(20), | ||
hasKey: __webpack_require__(63), | ||
hasValue: __webpack_require__(64), | ||
keys: __webpack_require__(16), | ||
isMatch: __webpack_require__(15), | ||
values: __webpack_require__(21) | ||
}; | ||
/***/ }), | ||
/* 62 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
module.exports = __webpack_require__(0); | ||
/***/ }), | ||
/* 63 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
module.exports = __webpack_require__(20); | ||
/***/ }), | ||
/* 64 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var contains = __webpack_require__(9); | ||
var values = __webpack_require__(21); | ||
module.exports = function (obj, value) { | ||
return contains(values(obj), value); | ||
}; | ||
/***/ }), | ||
/* 65 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var strUtil = { | ||
lc: __webpack_require__(56), | ||
lowerCase: __webpack_require__(17), | ||
lowerFirst: __webpack_require__(57), | ||
substitute: __webpack_require__(58), | ||
uc: __webpack_require__(59), | ||
upperCase: __webpack_require__(18), | ||
upperFirst: __webpack_require__(60) | ||
lc: __webpack_require__(66), | ||
lowerCase: __webpack_require__(22), | ||
lowerFirst: __webpack_require__(67), | ||
substitute: __webpack_require__(68), | ||
uc: __webpack_require__(69), | ||
upperCase: __webpack_require__(23), | ||
upperFirst: __webpack_require__(70) | ||
}; | ||
@@ -1268,12 +1438,12 @@ | ||
/***/ }), | ||
/* 56 */ | ||
/* 66 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
module.exports = __webpack_require__(17); | ||
module.exports = __webpack_require__(22); | ||
/***/ }), | ||
/* 57 */ | ||
/* 67 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var toString = __webpack_require__(7); | ||
var toString = __webpack_require__(8); | ||
@@ -1288,3 +1458,3 @@ var lowerFirst = function lowerFirst(value) { | ||
/***/ }), | ||
/* 58 */ | ||
/* 68 */ | ||
/***/ (function(module, exports) { | ||
@@ -1307,12 +1477,12 @@ | ||
/***/ }), | ||
/* 59 */ | ||
/* 69 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
module.exports = __webpack_require__(18); | ||
module.exports = __webpack_require__(23); | ||
/***/ }), | ||
/* 60 */ | ||
/* 70 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var toString = __webpack_require__(7); | ||
var toString = __webpack_require__(8); | ||
@@ -1327,24 +1497,24 @@ var upperFirst = function upperFirst(value) { | ||
/***/ }), | ||
/* 61 */ | ||
/* 71 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isType = __webpack_require__(3); | ||
var isType = __webpack_require__(4); | ||
var checkType = { | ||
getType: __webpack_require__(19), | ||
isArray: __webpack_require__(0), | ||
getType: __webpack_require__(24), | ||
isArray: __webpack_require__(1), | ||
isArrayLike: __webpack_require__(2), | ||
isBoolean: __webpack_require__(62), | ||
isFunction: __webpack_require__(5), | ||
isNil: __webpack_require__(6), | ||
isNull: __webpack_require__(63), | ||
isNumber: __webpack_require__(4), | ||
isObject: __webpack_require__(13), | ||
isObjectLike: __webpack_require__(9), | ||
isPlainObject: __webpack_require__(8), | ||
isPrototype: __webpack_require__(20), | ||
isBoolean: __webpack_require__(72), | ||
isFunction: __webpack_require__(3), | ||
isNil: __webpack_require__(7), | ||
isNull: __webpack_require__(73), | ||
isNumber: __webpack_require__(5), | ||
isObject: __webpack_require__(14), | ||
isObjectLike: __webpack_require__(11), | ||
isPlainObject: __webpack_require__(6), | ||
isPrototype: __webpack_require__(25), | ||
isType: isType, | ||
isUndefined: __webpack_require__(64), | ||
isString: __webpack_require__(21), | ||
isRegExp: __webpack_require__(65) | ||
isUndefined: __webpack_require__(74), | ||
isString: __webpack_require__(26), | ||
isRegExp: __webpack_require__(75) | ||
}; | ||
@@ -1361,3 +1531,3 @@ | ||
/***/ }), | ||
/* 62 */ | ||
/* 72 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -1371,3 +1541,3 @@ | ||
*/ | ||
var isType = __webpack_require__(3); | ||
var isType = __webpack_require__(4); | ||
@@ -1381,3 +1551,3 @@ var isBoolean = function isBoolean(value) { | ||
/***/ }), | ||
/* 63 */ | ||
/* 73 */ | ||
/***/ (function(module, exports) { | ||
@@ -1392,3 +1562,3 @@ | ||
/***/ }), | ||
/* 64 */ | ||
/* 74 */ | ||
/***/ (function(module, exports) { | ||
@@ -1403,6 +1573,6 @@ | ||
/***/ }), | ||
/* 65 */ | ||
/* 75 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isType = __webpack_require__(3); | ||
var isType = __webpack_require__(4); | ||
@@ -1416,8 +1586,8 @@ var isRegExp = function isRegExp(str) { | ||
/***/ }), | ||
/* 66 */ | ||
/* 76 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isFunction = __webpack_require__(5); | ||
var toArray = __webpack_require__(10); | ||
var mix = __webpack_require__(11); | ||
var isFunction = __webpack_require__(3); | ||
var toArray = __webpack_require__(12); | ||
var mix = __webpack_require__(13); | ||
@@ -1438,3 +1608,3 @@ var augment = function augment(c) { | ||
/***/ }), | ||
/* 67 */ | ||
/* 77 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -1444,3 +1614,3 @@ | ||
var isArray = __webpack_require__(0); | ||
var isArray = __webpack_require__(1); | ||
@@ -1478,7 +1648,7 @@ var clone = function clone(obj) { | ||
/***/ }), | ||
/* 68 */ | ||
/* 78 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isPlainObject = __webpack_require__(8); | ||
var isArray = __webpack_require__(0); | ||
var isPlainObject = __webpack_require__(6); | ||
var isArray = __webpack_require__(1); | ||
@@ -1528,7 +1698,7 @@ var MAX_MIX_LEVEL = 5; | ||
/***/ }), | ||
/* 69 */ | ||
/* 79 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isFunction = __webpack_require__(5); | ||
var mix = __webpack_require__(11); | ||
var isFunction = __webpack_require__(3); | ||
var mix = __webpack_require__(13); | ||
@@ -1568,6 +1738,6 @@ var extend = function extend(subclass, superclass, overrides, staticOverrides) { | ||
/***/ }), | ||
/* 70 */ | ||
/* 80 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var groupToMap = __webpack_require__(22); | ||
var groupToMap = __webpack_require__(27); | ||
@@ -1589,3 +1759,3 @@ var group = function group(data, condition) { | ||
/***/ }), | ||
/* 71 */ | ||
/* 81 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -1617,9 +1787,9 @@ | ||
/***/ }), | ||
/* 72 */ | ||
/* 82 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isNil = __webpack_require__(6); | ||
var isNil = __webpack_require__(7); | ||
var isArrayLike = __webpack_require__(2); | ||
var getType = __webpack_require__(19); | ||
var isPrototype = __webpack_require__(20); | ||
var getType = __webpack_require__(24); | ||
var isPrototype = __webpack_require__(25); | ||
var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
@@ -1661,7 +1831,7 @@ | ||
/***/ }), | ||
/* 73 */ | ||
/* 83 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var isFunction = __webpack_require__(5); | ||
var isEqual = __webpack_require__(24); | ||
var isFunction = __webpack_require__(3); | ||
var isEqual = __webpack_require__(29); | ||
/** | ||
@@ -1687,3 +1857,3 @@ * @param {*} value The value to compare. | ||
* | ||
* _.isEqualWith(array, other, customizer); // => true | ||
* isEqualWith(array, other, customizer); // => true | ||
*/ | ||
@@ -1701,6 +1871,6 @@ | ||
/***/ }), | ||
/* 74 */ | ||
/* 84 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var each = __webpack_require__(1); | ||
var each = __webpack_require__(0); | ||
var isArrayLike = __webpack_require__(2); | ||
@@ -1722,7 +1892,7 @@ | ||
/***/ }), | ||
/* 75 */ | ||
/* 85 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var each = __webpack_require__(1); | ||
var isPlaineObject = __webpack_require__(8); | ||
var each = __webpack_require__(0); | ||
var isPlaineObject = __webpack_require__(6); | ||
@@ -1758,3 +1928,3 @@ var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
/***/ }), | ||
/* 76 */ | ||
/* 86 */ | ||
/***/ (function(module, exports) { | ||
@@ -1761,0 +1931,0 @@ |
@@ -11,3 +11,3 @@ var isArray = require('../type/isArray'); | ||
* | ||
* _.flatten([1, [2, [3, [4]], 5]]); // => [1, 2, [3, [4]], 5] | ||
* flatten([1, [2, [3, [4]], 5]]); // => [1, 2, [3, [4]], 5] | ||
*/ | ||
@@ -14,0 +14,0 @@ var flatten = function flatten(arr) { |
module.exports = { | ||
contains: require('./contains'), | ||
difference: require('./difference'), | ||
find: require('./find'), | ||
firstValue: require('./firstValue'), | ||
flatten: require('./flatten'), | ||
flattenDeep: require('./flattenDeep'), | ||
getRange: require('./getRange'), | ||
@@ -12,4 +15,3 @@ merge: require('./merge'), | ||
union: require('./union'), | ||
uniq: require('./uniq'), | ||
values: require('./values') | ||
uniq: require('./uniq') | ||
}; |
var each = require('../each'); | ||
var toArray = require('../toArray'); | ||
var uniq = require('./uniq'); | ||
var union = function union() { | ||
var result = new Set(); | ||
var values = []; | ||
each(arguments, function (arg) { | ||
values = toArray(arg); | ||
each(values, function (val) { | ||
result.add(val); | ||
}); | ||
var result = []; | ||
var sources = toArray(arguments); | ||
each(sources, function (arr) { | ||
result = result.concat(arr); | ||
}); | ||
return Array.from(result); | ||
return uniq(result); | ||
}; | ||
module.exports = union; |
@@ -0,1 +1,2 @@ | ||
var each = require('../each'); | ||
var contains = require('./contains'); | ||
@@ -5,3 +6,3 @@ | ||
var resultArr = []; | ||
arr.forEach(function (item) { | ||
each(arr, function (item) { | ||
if (!contains(resultArr, item)) { | ||
@@ -8,0 +9,0 @@ resultArr.push(item); |
@@ -5,2 +5,3 @@ | ||
var mathUtil = require('./math'); | ||
var objectUtil = require('./object'); | ||
var stringUtil = require('./string'); | ||
@@ -16,2 +17,3 @@ var typeUtil = require('./type'); | ||
mathUtil: mathUtil, | ||
objectUtil: objectUtil, | ||
stringUtil: stringUtil, | ||
@@ -41,3 +43,3 @@ typeUtil: typeUtil, | ||
each([arrayUtil, eventUtil, mathUtil, stringUtil, typeUtil], function (collection) { | ||
each([arrayUtil, eventUtil, mathUtil, objectUtil, stringUtil, typeUtil], function (collection) { | ||
mix(util, collection); | ||
@@ -44,0 +46,0 @@ }); |
@@ -23,3 +23,3 @@ var isFunction = require('./type/isFunction'); | ||
* | ||
* _.isEqualWith(array, other, customizer); // => true | ||
* isEqualWith(array, other, customizer); // => true | ||
*/ | ||
@@ -26,0 +26,0 @@ |
{ | ||
"name": "@antv/util", | ||
"version": "1.0.12", | ||
"version": "1.1.0", | ||
"description": "A common util collection for antv projects", | ||
@@ -5,0 +5,0 @@ "main": "build/util.js", |
@@ -11,3 +11,3 @@ const isArray = require('../type/isArray'); | ||
* | ||
* _.flatten([1, [2, [3, [4]], 5]]); // => [1, 2, [3, [4]], 5] | ||
* flatten([1, [2, [3, [4]], 5]]); // => [1, 2, [3, [4]], 5] | ||
*/ | ||
@@ -14,0 +14,0 @@ const flatten = function(arr) { |
module.exports = { | ||
contains: require('./contains'), | ||
difference: require('./difference'), | ||
find: require('./find'), | ||
firstValue: require('./firstValue'), | ||
flatten: require('./flatten'), | ||
flattenDeep: require('./flattenDeep'), | ||
getRange: require('./getRange'), | ||
@@ -12,4 +15,3 @@ merge: require('./merge'), | ||
union: require('./union'), | ||
uniq: require('./uniq'), | ||
values: require('./values') | ||
uniq: require('./uniq') | ||
}; |
const each = require('../each'); | ||
const toArray = require('../toArray'); | ||
const uniq = require('./uniq'); | ||
const union = function() { | ||
const result = new Set(); | ||
let values = []; | ||
each(arguments, arg => { | ||
values = toArray(arg); | ||
each(values, val => { | ||
result.add(val); | ||
}); | ||
let result = []; | ||
const sources = toArray(arguments); | ||
each(sources, arr => { | ||
result = result.concat(arr); | ||
}); | ||
return Array.from(result); | ||
return uniq(result); | ||
}; | ||
module.exports = union; |
@@ -0,1 +1,2 @@ | ||
const each = require('../each'); | ||
const contains = require('./contains'); | ||
@@ -5,3 +6,3 @@ | ||
const resultArr = []; | ||
arr.forEach(item => { | ||
each(arr, item => { | ||
if (!contains(resultArr, item)) { | ||
@@ -8,0 +9,0 @@ resultArr.push(item); |
@@ -5,2 +5,3 @@ | ||
const mathUtil = require('./math'); | ||
const objectUtil = require('./object'); | ||
const stringUtil = require('./string'); | ||
@@ -16,2 +17,3 @@ const typeUtil = require('./type'); | ||
mathUtil, | ||
objectUtil, | ||
stringUtil, | ||
@@ -45,2 +47,3 @@ typeUtil, | ||
mathUtil, | ||
objectUtil, | ||
stringUtil, | ||
@@ -47,0 +50,0 @@ typeUtil |
@@ -23,3 +23,3 @@ const isFunction = require('./type/isFunction'); | ||
* | ||
* _.isEqualWith(array, other, customizer); // => true | ||
* isEqualWith(array, other, customizer); // => true | ||
*/ | ||
@@ -26,0 +26,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
125262
188
3919