-
-
Save e-jigsaw/ca6147022ac25ad6bc7b 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
contMap = (arr, f, g, ans) -> | |
if ans is undefined then ans = [] | |
if arr.length is 0 and typeof g is 'function' then return g ans else return | |
f.apply @, [ | |
arr.shift() | |
(item)-> contMap arr, f, g, ans.concat([item]) | |
ans | |
] | |
# Example | |
contMap queries, (query, next) -> | |
$.get "https://www.google.co.jp/search?q=" + query, (body) -> | |
# some process with body | |
next body | |
, (results) -> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ex: