refactor: prepare for boolean functions
All checks were successful
/ test (pull_request) Successful in 19s
All checks were successful
/ test (pull_request) Successful in 19s
* Defines a BooleanT type
* adds options to the Type constructor, so far just to allow conversions
from other types
* renames Number type to NumberT
* records the name of types, and puts the name in the string representation
* defines a conversion fron BooleanT to NumberT, specified to be automatic
* stub code for automatic conversions, not yet complete
* BooleanT not yet added to nanomath
Checked that the new facilities do not disrupt the prior behavior on numbers.
This commit is contained in:
parent
14011984a0
commit
5bee93dbb3
16 changed files with 123 additions and 62 deletions
11
src/number/__test__/NumberT.spec.js
Normal file
11
src/number/__test__/NumberT.spec.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import assert from 'assert'
|
||||
import {NumberT} from '../NumberT.js'
|
||||
|
||||
describe('NumberT Type', () => {
|
||||
it('correctly recognizes numbers', () => {
|
||||
assert(NumberT.test(3))
|
||||
assert(NumberT.test(NaN))
|
||||
assert(NumberT.test(Infinity))
|
||||
assert(!NumberT.test("3"))
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue