Created
March 24, 2016 14:08
-
-
Save vdeturckheim/275832f0ffebec886295 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Transforms an object to an array (drop the Object's keys) | |
* ``` | |
* let x = { a: 1, b: 2}; | |
* x.mapToArray() is [1, 2]; | |
* ``` | |
* @returns {Array} | |
*/ | |
Object.prototype.mapToArray = function () { | |
var self = this; | |
return Object.keys(self).map(function (key) { | |
return self[key]; | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment