src/index.js
function parseOptions(options) {
  let separator
  let transformer

  if (2 === options.length) {
    [separator, transformer] = options
    if (defaultTransformers[transformer]) {
      transformer = defaultTransformers[transformer] /* Don't validate */
      validate({ separator })
    } else {
      validate({ separator, transformer })
    }
  } else if (1 === options.length) {
    const option = options[0]
    if (false === option || 'function' === typeof option) {
      transformer = option /* Don't validate */
    } else if (defaultTransformers[option]) {
      transformer = defaultTransformers[option] /* Don't validate */
    } else {
      separator = option
      validate({ separator })
    }
  }

  return { separator, transformer }
}
function parseOptions(options) {
  let separator
  let transformer

  if (2 === options.length) {
    [separator, transformer] = options
    if (defaultTransformers[transformer]) {
      transformer = defaultTransformers[transformer] /* Don't validate */
      validate({ separator })
    } else {
      validate({ separator, transformer })
    }
  } else if (1 === options.length) {
    const option = options[0]
    if (false === option || 'function' === typeof option) {
      transformer = option /* Don't validate */
    } else if (defaultTransformers[option]) {
      transformer = defaultTransformers[option] /* Don't validate */
    } else {
      separator = option
      validate({ separator })
    }
  }

  return { separator, transformer }
}
function parseOptions ( options ) { let separator let transformer if ( 2 === options . length ) { [ separator , transformer ] = options if ( defaultTransformers [ transformer ] ) { transformer = defaultTransformers [ transformer ] /* Don't validate */ validate ( { separator } ) } else { validate ( { separator , transformer } ) } } else if ( 1 === options . length ) { const option = options [ 0 ] if ( false === option || 'function' === typeof option ) { transformer = option /* Don't validate */ } else if ( defaultTransformers [ option ] ) { transformer = defaultTransformers [ option ] /* Don't validate */ } else { separator = option validate ( { separator } ) } } return { separator , transformer } }
Check and return validated options
Check and return validated options