Add Set(iterable) polyfill for IE11

This commit is contained in:
Nick O'Leary 2020-08-04 20:59:32 +01:00
parent e691b1b7c3
commit 80d65b5acb
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 15 additions and 0 deletions

View File

@ -37,5 +37,20 @@
}
return result;
}
if (new Set([0]).size === 0) {
// IE does not support passing an iterable to Set constructor
var _Set = Set;
Set = function Set(iterable) {
var set = new _Set();
if (iterable) {
iterable.forEach(set.add, set);
}
return set;
};
Set.prototype = _Set.prototype;
Set.prototype.constructor = Set;
}
}
})();