101
Version:
common javascript utils that can be required selectively that assume es5+
24 lines (21 loc) • 445 B
JavaScript
/**
* Retrieve the values of an object's properties
* @module 101/values
*/
;
module.exports = values;
/**
* Borrowing from underscorejs
* https://github.com/jashkenas/underscore
* @param {Object} obj
* @return {Array}
*/
function values (obj) {
var keys = Object.keys(obj);
var length = keys.length;
var vals = new Array(length);
for (var i = 0; i < length; i++) {
vals[i] = obj[keys[i]];
}
return vals;
}