refactor(util) getNamesFromObjArray

This commit is contained in:
coderaiser 2015-02-17 08:49:27 -05:00
parent 54be194305
commit cc8309d046

View file

@ -528,16 +528,14 @@
* @pObj
*/
this.getNamesFromObjArray = function(arr) {
var ret = [],
isArray = Util.type.array(arr);
var ret = [];
if (arr && !isArray)
arr = arr.data;
if (!Array.isArray(arr))
throw(Error('arr should be array!'));
if (arr)
arr.forEach(function(item) {
ret.push(item.name || item);
});
arr.forEach(function(item) {
ret.push(item.name);
});
return ret;
};