Skip to content

Instantly share code, notes, and snippets.

@radjivF
Created June 14, 2016 08:20
Show Gist options
  • Save radjivF/8f4a8005a228dc5b6ff308b1a0e7af6b to your computer and use it in GitHub Desktop.
Save radjivF/8f4a8005a228dc5b6ff308b1a0e7af6b to your computer and use it in GitHub Desktop.
conditional promise in coffeescript
conditional = true
promises_list = []
if conditional?
#if conditional is true run this promises
p.push Promise.conditional conditional
p.push Promise.normal
Promise.all p
.then (output) ->
conditional_result = output.conditional_result
if conditional_result
console.log 'this the result of the conditional promise
console.log 'this the result of the normal promise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment