Skip to content

Commit

Permalink
Emulation for feature ITERATOR_HELPER
Browse files Browse the repository at this point in the history
  • Loading branch information
fasttime committed Jul 13, 2024
1 parent 5f8089a commit c242acb
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/helpers/feature-emulation.helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,28 @@
if (!global.Intl)
override(this, 'Intl', { value: { } });
},
ITERATOR_HELPER:
function ()
{
if (global.Iterator)
return;
var Iterator = function () { };
var arrayIterator;
if (Array.prototype.entries)
{
arrayIterator = [].entries();
Iterator.prototype = Object.getPrototypeOf(arrayIterator);
}
else
{
arrayIterator = new Iterator();
var entries = createStaticSupplier(arrayIterator);
override(this, 'Array.prototype.entries', { value: entries });
}
override(this, 'Iterator', { value: Iterator });
var filter = createStaticSupplier('[object Iterator Helper]');
override(this, 'Iterator.prototype.filter', { value: filter });
},
LOCALE_INFINITY:
function ()
{
Expand Down

0 comments on commit c242acb

Please sign in to comment.