mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 18:39:52 +00:00
Added ve.getObjectValues
Could maybe be optimized with map or something? Change-Id: I033804e893bfa93f991dee9efefaa2c2d1740627
This commit is contained in:
parent
d7febe6009
commit
f40e4f2f9d
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue