can-data-types/maybe-number/maybe-number
A type that can be a Number, null
, or undefined
.
Object
An object with the can.new
, can.getSchema
, can.isMember
symbols.
Use
Normally, MaybeNumber
is used as part of can-define or [can-query-logic],
but it can be used directly too:
import MaybeNumber from "can-data-types/maybe-number/maybe-number";
import canReflect from "can-reflect";
canReflect.new(MaybeNumber, "1") //-> 1
MaybeNumber[Symbol.for("can.isMember")](1) //-> true
MaybeNumber[Symbol.for("can.isMember")]("1") //-> false
MaybeNumber[Symbol.for("can.isMember")](null) //-> true