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.`,
|
)} given.`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (typeof opts === 'object' && opts) {
|
if (typeof opts === 'object' && opts !== null) {
|
||||||
if (Object.prototype.hasOwnProperty.call(opts, 'range')) {
|
if (Object.prototype.hasOwnProperty.call(opts, 'range')) {
|
||||||
if (!Array.isArray(opts.range)) {
|
if (!Array.isArray(opts.range)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
@ -163,26 +163,26 @@ export const number = (
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (Object.prototype.hasOwnProperty.call(opts, 'nudgeMultiplier')) {
|
||||||
if (Object.prototype.hasOwnProperty.call(opts, 'nudgeMultiplier')) {
|
if (
|
||||||
if (
|
typeof opts!.nudgeMultiplier !== 'number' ||
|
||||||
typeof opts!.nudgeMultiplier !== 'number' ||
|
!isFinite(opts!.nudgeMultiplier)
|
||||||
!isFinite(opts!.nudgeMultiplier)
|
) {
|
||||||
) {
|
throw new Error(
|
||||||
throw new Error(
|
`opts.nudgeMultiplier in t.number(defaultValue, opts) must be a finite number. ${userReadableTypeOfValue(
|
||||||
`opts.nudgeMultiplier in t.number(defaultValue, opts) must be a finite number. ${userReadableTypeOfValue(
|
opts!.nudgeMultiplier,
|
||||||
opts!.nudgeMultiplier,
|
)} given.`,
|
||||||
)} given.`,
|
)
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
}
|
if (Object.prototype.hasOwnProperty.call(opts, 'nudgeFn')) {
|
||||||
if (Object.prototype.hasOwnProperty.call(opts, 'nudgeFn')) {
|
if (typeof opts?.nudgeFn !== 'function') {
|
||||||
if (typeof opts?.nudgeFn !== 'function') {
|
throw new Error(
|
||||||
throw new Error(
|
`opts.nudgeFn in t.number(defaultValue, opts) must be a function. ${userReadableTypeOfValue(
|
||||||
`opts.nudgeFn in t.number(defaultValue, opts) must be a function. ${userReadableTypeOfValue(
|
opts!.nudgeFn,
|
||||||
opts!.nudgeFn,
|
)} given.`,
|
||||||
)} given.`,
|
)
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue