Skip to content

Instantly share code, notes, and snippets.

@dotsonjb14
Created February 5, 2016 18:19
Show Gist options
  • Save dotsonjb14/67d5d79f8688dc01fbcc to your computer and use it in GitHub Desktop.
Save dotsonjb14/67d5d79f8688dc01fbcc to your computer and use it in GitHub Desktop.
adding map to Map and Set
(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