Thursday, 8 June 2017

Existing process in a function

Is it possible or does it make sense to exit a node process in a function as I have here:

export function extractOptions(options){
  for (let option of options) {
    if(!option || option.length < 1){
      logMissing(option[0][0])
      process.exit(1)
      return []
    }
  }

  return options
}

My test doesn't get back a [] if the if statement finds that there is no option or option length is 0.



via PositiveGuy

No comments:

Post a Comment