Skip to content

Commit

Permalink
Improve forcedOpts validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 17, 2019
1 parent 9b7f776 commit a13981b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/options/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import { CHILD_PROCESS_OPTS, EXECA_OPTS } from './upstream.js'
import { validateCustom } from './custom.js'
import { addVerbose } from './verbose.js'

// eslint-disable-next-line no-shadow
const { hasOwnProperty } = Object.prototype

// Parse options
export const parseOpts = function({
opts = {},
Expand All @@ -20,7 +23,7 @@ export const parseOpts = function({

const exampleConfig = pickBy(
{ ...EXAMPLE_OPTS, ...defaultOpts },
(value, key) => forcedOpts[key] === undefined,
(value, key) => !hasOwnProperty.call(forcedOpts, key),
)

kValidate(optsA, { exampleConfig })
Expand Down

0 comments on commit a13981b

Please sign in to comment.