bbo
Version:
bbo is a utility library of zero dependencies for javascript.
17 lines (15 loc) • 312 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;