13 lines
414 B
TypeScript
13 lines
414 B
TypeScript
import type { FnNaN, FnOne, FnZero, FnRe } from "../interfaces/arithmetic"
|
|
|
|
export const number_type = {
|
|
before: ['Complex'],
|
|
test: (n: unknown): n is number => typeof n === 'number',
|
|
from: { string: (s: string) => +s }
|
|
}
|
|
|
|
export const zero: FnZero<number> = (a) => 0
|
|
export const one: FnOne<number> = (a) => 1
|
|
export const nan: FnNaN<number> = (a) => NaN
|
|
export const re: FnRe<number, number> = (a) => a
|