source: imaps-frontend/node_modules/es-iterator-helpers/Iterator/implementation.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 894 bytes
Line 
1'use strict';
2
3var GetIntrinsic = require('get-intrinsic');
4var hasPropertyDescriptors = require('has-property-descriptors')();
5
6var $TypeError = require('es-errors/type');
7var $defineProperty = hasPropertyDescriptors && GetIntrinsic('%Object.defineProperty%', true);
8
9var iterProto = require('iterator.prototype');
10var callBound = require('call-bind/callBound');
11
12var $isPrototypeOf = callBound('Object.prototype.isPrototypeOf');
13
14var $Iterator = typeof Iterator === 'function' ? Iterator : function Iterator() {
15 if (
16 !(this instanceof Iterator)
17 || this.constructor === Iterator
18 || !$isPrototypeOf(Iterator, this.constructor)
19 ) {
20 throw new $TypeError('`Iterator` can not be called or constructed directly');
21 }
22};
23
24if ($Iterator.prototype !== iterProto) {
25 $Iterator.prototype = iterProto;
26}
27$defineProperty($Iterator, 'prototype', { writable: false });
28
29module.exports = $Iterator;
Note: See TracBrowser for help on using the repository browser.