UNPKG

lenye_base

Version:

基础方法

19 lines (16 loc) 331 B
'use strict'; /** * 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;