2025-04-13 16:29:51 +00:00
|
|
|
import {plain, boolnum} from './helpers.js'
|
|
|
|
import {NumberT} from './NumberT.js'
|
|
|
|
|
2025-04-25 14:17:34 +00:00
|
|
|
import {match} from '#core/TypePatterns.js'
|
2025-03-30 20:00:07 -07:00
|
|
|
|
|
|
|
export const clone = plain(a => a)
|
refactor: change onType to match and take only one pattern and result (#22)
Pursuant to #12. Besides changing the name of onType to match, and only allowing one pattern and result in `match()`,
this PR also arranges that in place of an onType with lots of alternating PATTERN, VALUE, PATTERN, VALUE arguments, one now exports an _array_ of `match(PATTERN, VALUE)` items.
Doesn't quite fully resolve #12, because there is still the question of whether `match(...)` can be left out for a behavior that literally matches anything (current behavior), or whether `match(Passthru, behavior)` should be required for such cases.
Reviewed-on: https://code.studioinfinity.org/StudioInfinity/nanomath/pulls/22
Co-authored-by: Glen Whitney <glen@studioinfinity.org>
Co-committed-by: Glen Whitney <glen@studioinfinity.org>
2025-04-22 05:01:21 +00:00
|
|
|
export const isnan = match(NumberT, boolnum(isNaN))
|