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:
619 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var callBound = require('call-bind/callBound');
|
---|
4 | var $arrayPush = callBound('Array.prototype.push');
|
---|
5 |
|
---|
6 | var GetIterator = require('./GetIterator');
|
---|
7 | var IteratorStep = require('./IteratorStep');
|
---|
8 | var IteratorValue = require('./IteratorValue');
|
---|
9 |
|
---|
10 | // https://262.ecma-international.org/8.0/#sec-iterabletolist
|
---|
11 |
|
---|
12 | module.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.