lenye_base
Version:
基础方法
17 lines (15 loc) • 314 B
JavaScript
/**
* Get the attribute values in an array object and combine them into a new array
*/
function pluck(target, name) {
var result = [];
var temp;
target.forEach(function (item) {
if (item[name]) {
temp = item[name];
result.push(temp);
}
});
return result;
}
export default pluck;