2022-03-25 08:54:20 +00:00
|
|
|
export function isNumber(x) {
|
|
|
|
return typeof x === 'number'
|
|
|
|
}
|
|
|
|
|
2022-03-25 07:49:03 +00:00
|
|
|
export function allNumbers(args) {
|
2022-03-25 08:54:20 +00:00
|
|
|
for (let i = 0; i < args.length; ++i) {
|
|
|
|
if (!isNumber(args[i])) return false
|
|
|
|
}
|
|
|
|
return true
|
2022-03-25 07:49:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function oneNumber(args) {
|
2022-03-25 08:54:20 +00:00
|
|
|
return args.length === 1 && isNumber(args[0])
|
2022-03-25 07:49:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default function create(pmath) {
|
2022-03-25 08:54:20 +00:00
|
|
|
return pmath('number', [() => true, x => Number(x)])
|
2022-03-25 07:49:03 +00:00
|
|
|
}
|