Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Map.filter polyfill
Object.defineProperty(Map.prototype, 'filter', {
value: function (filterFunction) {
const myMap = new Map();
for (const [key, value] of this) {
if (filterFunction(value, key, this)) {
myMap.set(key, value);
return myMap;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment