Created
December 22, 2016 17:25
-
-
Save ardeshireshghi/a372a103a50b602e4efdb691a48c61ad to your computer and use it in GitHub Desktop.
Added some of the dict python api to JS Object type
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
;((Object) => { | |
Object.prototype.keys = Object.prototype.keys || function() { | |
return Object.keys(this); | |
} | |
Object.prototype.values = Object.prototype.values || function() { | |
return this.keys().map(key => this[key]); | |
} | |
Object.prototype.items = Object.prototype.items || function() { | |
return this.keys().map((key) => { | |
return [key, this[key]]; | |
}); | |
} | |
})(Object); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment