Created
December 14, 2015 08:30
-
-
Save wildeyes/5877dec004effcc81e3f to your computer and use it in GitHub Desktop.
My favourite, essential " polyfills " for projects with coffeescripts.
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
# xxx turn this into a bower/npm module | |
Object.defineProperty Array.prototype, "last", { get: -> this[this.length - 1]} | |
Object.defineProperty Array.prototype, "first", { get: -> this[0]} | |
Function::property = (prop, desc) -> | |
Object.defineProperty @prototype, prop, desc | |
Function::getter = (prop, get) -> | |
Object.defineProperty @prototype, prop, {get, configurable: yes} | |
Function::setter = (prop, set) -> | |
Object.defineProperty @prototype, prop, {set, configurable: yes} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment