source: frontend/node_modules/es-abstract/2017/GetIterator.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 755 bytes
RevLine 
[9af201e]1'use strict';
2
3var $TypeError = require('es-errors/type');
4
5var getIteratorMethod = require('../helpers/getIteratorMethod');
6var AdvanceStringIndex = require('./AdvanceStringIndex');
7var Call = require('./Call');
8var GetMethod = require('./GetMethod');
9
10var isObject = require('es-object-atoms/isObject');
11
12var ES = {
13 AdvanceStringIndex: AdvanceStringIndex,
14 GetMethod: GetMethod
15};
16
17// https://262.ecma-international.org/6.0/#sec-getiterator
18
19module.exports = function GetIterator(obj, method) {
20 var actualMethod = method;
21 if (arguments.length < 2) {
22 actualMethod = getIteratorMethod(ES, obj);
23 }
24 var iterator = Call(actualMethod, obj);
25 if (!isObject(iterator)) {
26 throw new $TypeError('iterator must return an object');
27 }
28
29 return iterator;
30};
Note: See TracBrowser for help on using the repository browser.