Last active
June 28, 2020 18:41
-
-
Save Alamin02/47b7ebeedb97a086482a0f4d93da2d59 to your computer and use it in GitHub Desktop.
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
const content = require('./dummy.json'); | |
function* makeUrlIterator(content) { | |
const { groups } = content; | |
for (const group of groups) { | |
const { data } = group; | |
for (const entry of data) { | |
yield entry; | |
} | |
} | |
} | |
const urlIterator = makeUrlIterator(content); | |
console.log(urlIterator.next().value); | |
// Outputs the first value | |
console.log(urlIterator.next().value); | |
// Outputs the second value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment