I would like to jump out of an outer function from inside an inner function.
something = true
outer: (next)->
@inner (err)->
if err?
next err
#jump out of outer function here
console.log 'still in outer'
inner: (next)->
next new Error 'oops' if @something is true
The code is in coffeescript but javascript answers are welcome.
Update
Thanks for the quick replies - so how about using the return value of the @inner
function? Is there a generally accepted pattern for this kind of thing?
something = true
outer: (next)->
return unless @inner (err)-> next err if err
console.log 'still in outer'
inner: (next)->
if @something is true
next new Error 'oops'
return false
return true