source: imaps-frontend/node_modules/es-abstract/2019/IterableToList.js@ d565449

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

Update repo after prototype presentation

  • Property mode set to 100644
File size: 619 bytes
Line 
1'use strict';
2
3var callBound = require('call-bind/callBound');
4var $arrayPush = callBound('Array.prototype.push');
5
6var GetIterator = require('./GetIterator');
7var IteratorStep = require('./IteratorStep');
8var IteratorValue = require('./IteratorValue');
9
10// https://262.ecma-international.org/8.0/#sec-iterabletolist
11
12module.exports = function IterableToList(items, method) {
13 var iterator = GetIterator(items, method);
14 var values = [];
15 var next = true;
16 while (next) {
17 next = IteratorStep(iterator);
18 if (next) {
19 var nextValue = IteratorValue(next);
20 $arrayPush(values, nextValue);
21 }
22 }
23 return values;
24};
Note: See TracBrowser for help on using the repository browser.