Skip to content

Commit

Permalink
Fix options validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 10, 2019
1 parent 0d2f10a commit 6bfcd02
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import { pickBy } from './utils.js'
// TODO: validate options (including that `input` is a string)
export const parseOpts = function({ opts = {}, defaultOpts, forcedOpts = {} }) {
const optsA = pickBy(opts, value => value !== undefined)
const optsB = { ...DEFAULT_OPTS, ...defaultOpts, ...optsA, ...forcedOpts }

const exampleConfig = pickBy(
{ ...EXAMPLE_OPTS, ...defaultOpts },
(value, key) => forcedOpts[key] === undefined,
)
validate(optsB, { exampleConfig })
validate(optsA, { exampleConfig })

const optsB = { ...DEFAULT_OPTS, ...defaultOpts, ...optsA, ...forcedOpts }
const optsC = addStdio({ opts: optsB })
return optsC
}
Expand Down

0 comments on commit 6bfcd02

Please sign in to comment.