mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 15:57:48 +00:00
19 lines
355 B
JavaScript
19 lines
355 B
JavaScript
/**
|
|
* Converts `iterator` to an array.
|
|
*
|
|
* @private
|
|
* @param {Object} iterator The iterator to convert.
|
|
* @returns {Array} Returns the converted array.
|
|
*/
|
|
function iteratorToArray(iterator) {
|
|
let data
|
|
const result = []
|
|
|
|
while (!(data = iterator.next()).done) {
|
|
result.push(data.value)
|
|
}
|
|
return result
|
|
}
|
|
|
|
export default iteratorToArray
|