Added ve.getObjectValues

Could maybe be optimized with map or something?

Change-Id: I033804e893bfa93f991dee9efefaa2c2d1740627
This commit is contained in:
Trevor Parscal 2012-05-14 11:31:18 -07:00
parent d7febe6009
commit f40e4f2f9d

View file

@ -97,6 +97,26 @@ ve.getObjectKeys = Object.keys || function( obj ) {
return keys;
};
/**
* Gets an array of all property values in an object.
*
* @static
* @method
* @param {Object} Object to get values from
* @returns {Array} List of object values
*/
ve.getObjectValues = function( obj ) {
var values = [],
key,
hop = Object.prototype.hasOwnProperty;
for ( key in obj ) {
if ( hop.call( obj, key ) ) {
values.push( obj[key] );
}
}
return values;
};
/**
* Recursively compares string and number property between two objects.
*