Created
February 13, 2018 16:19
-
-
Save kmaglione/754fbdd582e881faac111970e8ff9182 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
function each(ary, fn) { | |
ary = Array.from(ary); | |
return (function next() { | |
if (ary.length) { | |
return Promise.resolve(fn(ary.shift())).then(next); | |
} | |
})(); | |
} | |
each(category.channels, channel => { | |
return list(channel).then(items => { | |
return each(items, item => { | |
return process(item, category.id); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment