19 lines
393 B
JavaScript
19 lines
393 B
JavaScript
export function isNumber(x) {
|
|
return typeof x === 'number'
|
|
}
|
|
|
|
export function allNumbers(args) {
|
|
for (let i = 0; i < args.length; ++i) {
|
|
if (!isNumber(args[i])) return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
export function oneNumber(args) {
|
|
return args.length === 1 && isNumber(args[0])
|
|
}
|
|
|
|
export default function create(pmath) {
|
|
return pmath('number', [() => true, x => Number(x)])
|
|
}
|