Fixed the tests
This commit is contained in:
parent
7815fb2dc3
commit
eb695a1c91
1 changed files with 20 additions and 20 deletions
|
@ -143,7 +143,7 @@ export const number = (
|
|||
)} given.`,
|
||||
)
|
||||
}
|
||||
if (typeof opts === 'object' && opts) {
|
||||
if (typeof opts === 'object' && opts !== null) {
|
||||
if (Object.prototype.hasOwnProperty.call(opts, 'range')) {
|
||||
if (!Array.isArray(opts.range)) {
|
||||
throw new Error(
|
||||
|
@ -163,26 +163,26 @@ export const number = (
|
|||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(opts, 'nudgeMultiplier')) {
|
||||
if (
|
||||
typeof opts!.nudgeMultiplier !== 'number' ||
|
||||
!isFinite(opts!.nudgeMultiplier)
|
||||
) {
|
||||
throw new Error(
|
||||
`opts.nudgeMultiplier in t.number(defaultValue, opts) must be a finite number. ${userReadableTypeOfValue(
|
||||
opts!.nudgeMultiplier,
|
||||
)} given.`,
|
||||
)
|
||||
if (Object.prototype.hasOwnProperty.call(opts, 'nudgeMultiplier')) {
|
||||
if (
|
||||
typeof opts!.nudgeMultiplier !== 'number' ||
|
||||
!isFinite(opts!.nudgeMultiplier)
|
||||
) {
|
||||
throw new Error(
|
||||
`opts.nudgeMultiplier in t.number(defaultValue, opts) must be a finite number. ${userReadableTypeOfValue(
|
||||
opts!.nudgeMultiplier,
|
||||
)} given.`,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(opts, 'nudgeFn')) {
|
||||
if (typeof opts?.nudgeFn !== 'function') {
|
||||
throw new Error(
|
||||
`opts.nudgeFn in t.number(defaultValue, opts) must be a function. ${userReadableTypeOfValue(
|
||||
opts!.nudgeFn,
|
||||
)} given.`,
|
||||
)
|
||||
if (Object.prototype.hasOwnProperty.call(opts, 'nudgeFn')) {
|
||||
if (typeof opts?.nudgeFn !== 'function') {
|
||||
throw new Error(
|
||||
`opts.nudgeFn in t.number(defaultValue, opts) must be a function. ${userReadableTypeOfValue(
|
||||
opts!.nudgeFn,
|
||||
)} given.`,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue