This commit is contained in:
Iliyan Angelov
2025-09-14 23:24:25 +03:00
commit c67067a2a4
71311 changed files with 6800714 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
'use strict';
require('./shim')();

View File

@@ -0,0 +1,29 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var hasPropertyDescriptors = require('has-property-descriptors')();
var $TypeError = require('es-errors/type');
var $defineProperty = hasPropertyDescriptors && GetIntrinsic('%Object.defineProperty%', true);
var iterProto = require('iterator.prototype');
var callBound = require('call-bound');
var $isPrototypeOf = callBound('Object.prototype.isPrototypeOf');
var $Iterator = typeof Iterator === 'function' ? Iterator : function Iterator() {
if (
!(this instanceof Iterator)
|| this.constructor === Iterator
|| !$isPrototypeOf(Iterator, this.constructor)
) {
throw new $TypeError('`Iterator` can not be called or constructed directly');
}
};
if ($Iterator.prototype !== iterProto) {
$Iterator.prototype = iterProto;
}
$defineProperty($Iterator, 'prototype', { writable: false });
module.exports = $Iterator;

View File

@@ -0,0 +1,18 @@
'use strict';
var define = require('define-properties');
var callBind = require('call-bind');
var implementation = require('./implementation');
var getPolyfill = require('./polyfill');
var shim = require('./shim');
var polyfill = callBind(getPolyfill());
define(polyfill, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});
module.exports = polyfill;

View File

@@ -0,0 +1,8 @@
'use strict';
var globalThis = require('globalthis')();
var implementation = require('./implementation');
module.exports = function getPolyfill() {
return typeof globalThis.Iterator === 'function' ? globalThis.Iterator : implementation;
};

View File

@@ -0,0 +1,18 @@
'use strict';
var define = require('define-properties');
var globalThis = require('globalthis')();
var getPolyfill = require('./polyfill');
module.exports = function shimIterator() {
var polyfill = getPolyfill();
define(
globalThis,
{ Iterator: polyfill },
{ Iterator: function () { return Iterator !== polyfill; } }
);
return polyfill;
};