Created
February 5, 2016 18:19
-
-
Save dotsonjb14/67d5d79f8688dc01fbcc to your computer and use it in GitHub Desktop.
adding map to Map and Set
This file contains hidden or 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
(function () { | |
if (Map !== void 0 && Map.prototype.map === void 0) { | |
Map.prototype.map = function (func) { | |
return [...this].map(x => func(...x)); | |
}; | |
} | |
if(Set !== void 0 && Set.prototype.map === void 0) { | |
Set.prototype.map = function (func) { | |
return [...this].map(x => func(x)); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment