@antv/util
Advanced tools
Comparing version 2.0.7 to 2.0.8
@@ -1,2 +0,1 @@ | ||
import each from './each'; | ||
import isArrayLike from './is-array-like'; | ||
@@ -8,7 +7,8 @@ var filter = function (arr, func) { | ||
var result = []; | ||
each(arr, function (value, index) { | ||
for (var index = 0; index < arr.length; index++) { | ||
var value = arr[index]; | ||
if (func(value, index)) { | ||
result.push(value); | ||
} | ||
}); | ||
} | ||
return result; | ||
@@ -15,0 +15,0 @@ }; |
import isArray from './is-array'; | ||
import filter from './filter'; | ||
var getRange = function (values) { | ||
// 存在 NaN 时,min,max 判定会出问题 | ||
values = filter(values, function (v) { | ||
return !isNaN(v); | ||
}); | ||
if (!values.length) { // 如果没有数值则直接返回0 | ||
var filterValues = values.filter(function (v) { return !isNaN(v); }); | ||
if (!filterValues.length) { // 如果没有数值则直接返回0 | ||
return { | ||
min: 0, | ||
max: 0 | ||
max: 0, | ||
}; | ||
@@ -19,9 +16,9 @@ } | ||
} | ||
values = tmp; | ||
filterValues = tmp; | ||
} | ||
var max = Math.max.apply(null, values); | ||
var min = Math.min.apply(null, values); | ||
var max = Math.max.apply(null, filterValues); | ||
var min = Math.min.apply(null, filterValues); | ||
return { | ||
min: min, | ||
max: max | ||
max: max, | ||
}; | ||
@@ -28,0 +25,0 @@ }; |
@@ -1,2 +0,1 @@ | ||
import each from './each'; | ||
import isArray from './is-array'; | ||
@@ -13,3 +12,4 @@ import isFunction from './is-function'; | ||
var key; | ||
each(data, function (item) { | ||
for (var i = 0; i < data.length; i++) { | ||
var item = data[i]; | ||
key = predicate(item); | ||
@@ -22,3 +22,3 @@ if (hasOwnProperty.call(result, key)) { | ||
} | ||
}); | ||
} | ||
return result; | ||
@@ -25,0 +25,0 @@ } |
@@ -7,3 +7,3 @@ import isArray from './is-array'; | ||
return { | ||
0: data | ||
0: data, | ||
}; | ||
@@ -10,0 +10,0 @@ } |
@@ -1,2 +0,1 @@ | ||
import each from './each'; | ||
import isArrayLike from './is-array-like'; | ||
@@ -9,5 +8,6 @@ var map = function (arr, func) { | ||
var result = []; | ||
each(arr, function (value, index) { | ||
for (var index = 0; index < arr.length; index++) { | ||
var value = arr[index]; | ||
result.push(func(value, index)); | ||
}); | ||
} | ||
return result; | ||
@@ -14,0 +14,0 @@ }; |
@@ -1,2 +0,1 @@ | ||
import each from './each'; | ||
import isArray from './is-array'; | ||
@@ -7,3 +6,4 @@ import isNil from './is-nil'; | ||
var tmpMap = {}; | ||
data.forEach(function (obj) { | ||
for (var i = 0; i < data.length; i++) { | ||
var obj = data[i]; | ||
var value = obj[name]; | ||
@@ -15,3 +15,4 @@ if (!isNil(value)) { | ||
} | ||
each(value, function (val) { | ||
for (var j = 0; j < value.length; j++) { | ||
var val = value[j]; | ||
// unique | ||
@@ -22,7 +23,7 @@ if (!tmpMap[val]) { | ||
} | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
return rst; | ||
}); | ||
//# sourceMappingURL=values-of-key.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var each_1 = require("./each"); | ||
var is_array_like_1 = require("./is-array-like"); | ||
@@ -10,7 +9,8 @@ var filter = function (arr, func) { | ||
var result = []; | ||
each_1.default(arr, function (value, index) { | ||
for (var index = 0; index < arr.length; index++) { | ||
var value = arr[index]; | ||
if (func(value, index)) { | ||
result.push(value); | ||
} | ||
}); | ||
} | ||
return result; | ||
@@ -17,0 +17,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var is_array_1 = require("./is-array"); | ||
var filter_1 = require("./filter"); | ||
var getRange = function (values) { | ||
// 存在 NaN 时,min,max 判定会出问题 | ||
values = filter_1.default(values, function (v) { | ||
return !isNaN(v); | ||
}); | ||
if (!values.length) { // 如果没有数值则直接返回0 | ||
var filterValues = values.filter(function (v) { return !isNaN(v); }); | ||
if (!filterValues.length) { // 如果没有数值则直接返回0 | ||
return { | ||
min: 0, | ||
max: 0 | ||
max: 0, | ||
}; | ||
@@ -21,9 +18,9 @@ } | ||
} | ||
values = tmp; | ||
filterValues = tmp; | ||
} | ||
var max = Math.max.apply(null, values); | ||
var min = Math.min.apply(null, values); | ||
var max = Math.max.apply(null, filterValues); | ||
var min = Math.min.apply(null, filterValues); | ||
return { | ||
min: min, | ||
max: max | ||
max: max, | ||
}; | ||
@@ -30,0 +27,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var each_1 = require("./each"); | ||
var is_array_1 = require("./is-array"); | ||
@@ -15,3 +14,4 @@ var is_function_1 = require("./is-function"); | ||
var key; | ||
each_1.default(data, function (item) { | ||
for (var i = 0; i < data.length; i++) { | ||
var item = data[i]; | ||
key = predicate(item); | ||
@@ -24,3 +24,3 @@ if (hasOwnProperty.call(result, key)) { | ||
} | ||
}); | ||
} | ||
return result; | ||
@@ -27,0 +27,0 @@ } |
@@ -9,3 +9,3 @@ "use strict"; | ||
return { | ||
0: data | ||
0: data, | ||
}; | ||
@@ -12,0 +12,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var each_1 = require("./each"); | ||
var is_array_like_1 = require("./is-array-like"); | ||
@@ -11,5 +10,6 @@ var map = function (arr, func) { | ||
var result = []; | ||
each_1.default(arr, function (value, index) { | ||
for (var index = 0; index < arr.length; index++) { | ||
var value = arr[index]; | ||
result.push(func(value, index)); | ||
}); | ||
} | ||
return result; | ||
@@ -16,0 +16,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var each_1 = require("./each"); | ||
var is_array_1 = require("./is-array"); | ||
@@ -9,3 +8,4 @@ var is_nil_1 = require("./is-nil"); | ||
var tmpMap = {}; | ||
data.forEach(function (obj) { | ||
for (var i = 0; i < data.length; i++) { | ||
var obj = data[i]; | ||
var value = obj[name]; | ||
@@ -17,3 +17,4 @@ if (!is_nil_1.default(value)) { | ||
} | ||
each_1.default(value, function (val) { | ||
for (var j = 0; j < value.length; j++) { | ||
var val = value[j]; | ||
// unique | ||
@@ -24,7 +25,7 @@ if (!tmpMap[val]) { | ||
} | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
return rst; | ||
}); | ||
//# sourceMappingURL=values-of-key.js.map |
{ | ||
"name": "@antv/util", | ||
"version": "2.0.7", | ||
"version": "2.0.8", | ||
"description": "A common util collection for antv projects", | ||
@@ -52,4 +52,3 @@ "main": "lib/index.js", | ||
"tslib": "^1.10.0" | ||
}, | ||
"gitHead": "502334a1fb8acb3bfdbeb6cd7a34175f75c3e04f" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
269577
0
4587