Permalink
Cannot retrieve contributors at this time
24 lines (20 sloc)
627 Bytes
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/es-abstract/2020/IterableToList.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var callBound = require('call-bind/callBound'); | |
var $arrayPush = callBound('Array.prototype.push'); | |
var GetIterator = require('./GetIterator'); | |
var IteratorStep = require('./IteratorStep'); | |
var IteratorValue = require('./IteratorValue'); | |
// https://262.ecma-international.org/9.0/#sec-iterabletolist | |
module.exports = function IterableToList(items, method) { | |
var iterator = GetIterator(items, 'sync', method); | |
var values = []; | |
var next = true; | |
while (next) { | |
next = IteratorStep(iterator); | |
if (next) { | |
var nextValue = IteratorValue(next); | |
$arrayPush(values, nextValue); | |
} | |
} | |
return values; | |
}; |