prelude-ls icon indicating copy to clipboard operation
prelude-ls copied to clipboard

Nice to have function async-each

Open askucher opened this issue 9 years ago • 1 comments

async-each = (func, arr) -->
      items = arr.slice!
      go = ->
          item = items.splice(0, 1).0
          if item?
             func item, go
      go!

example


[1,2,3] |> async-each (number,done)->
    find-user id: number, (err, user)->
        if user? and confirm 'Are you sure?'
            delete-user number, ->
                done!


askucher avatar Jul 25 '15 09:07 askucher

Sounds approximately like async.js::each |> flip |> curry.

I think async functions are out of scope for prelude-ls. Maybe it's time for a prelude-ls-async library?

anko avatar Jul 25 '15 13:07 anko