Skip to content

Commit

Permalink
Validate onCreate
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Jun 5, 2022
1 parent fdfc9ac commit 1eed8e0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/error/modern/opts.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ export const getOpts = function (opts = {}) {
}

const { onCreate } = opts
validateOnCreate(onCreate)
return { onCreate }
}

const isObject = function (value) {
return typeof value === 'object' && value !== null
}

const validateOnCreate = function (onCreate) {
if (typeof onCreate !== 'function') {
throw new TypeError(`"onCreate" option must be a function: ${onCreate}`)
}
}

0 comments on commit 1eed8e0

Please sign in to comment.