Guest User

Untitled

a guest
Feb 25th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. function each(ary, fn) {
  2. ary = Array.from(ary);
  3. return (function next() {
  4. if (ary.length) {
  5. return Promise.resolve(fn(ary.shift())).then(next);
  6. }
  7. })();
  8. }
  9. each(category.channels, channel => {
  10. return list(channel).then(items => {
  11. return each(items, item => {
  12. return process(item, category.id);
  13. });
  14. });
  15. });
Add Comment
Please, Sign In to add comment