can-data-types
Version:
Reusable special data types
25 lines (17 loc) • 691 B
Markdown
{Object} can-data-types/maybe-string/maybe-string
can-data-types
A type that can be a String, `null`, or `undefined`.
{Object}
An object with the `can.new`, `can.getSchema`, `can.isMember` symbols.
## Use
Normally, `MaybeString` is used as part of [can-define] or [can-query-logic],
but it can be used directly too:
```js
import MaybeString from "can-data-types/maybe-string/maybe-string";
import canReflect from "can-reflect";
canReflect.new(MaybeString, 1) //-> "1"
MaybeString[Symbol.for("can.isMember")]("1") //-> true
MaybeString[Symbol.for("can.isMember")](1) //-> false
MaybeString[Symbol.for("can.isMember")](null) //-> true
```