bbo
Version:
bbo is a utility library of zero dependencies for javascript.
19 lines (16 loc) • 329 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;
}
module.exports = pluck;