Created
October 29, 2018 08:57
-
-
Save ltciro/3ab19bcd4ae2718b2d47f921b8a6e858 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const Ix = require('ix'); | |
async function* arrGen() { | |
yield 1; | |
yield 2; | |
yield 4; | |
} | |
const results = Ix.AsyncIterable.from(arrGen()) | |
.filter(x => x % 2 === 0) | |
.map(x => x * 2); | |
async function arrReadFromIterator() { | |
// leé los values del async iterator con la sentencia for...of | |
for await (const n of results ){ | |
console.log(n) | |
} | |
} | |
arrReadFromIterator() | |
//4 | |
//8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment