TypeObject
An object describing how to test membership for and convert to a specified type.
Object
A TypeObject
is any object which conforms to this API:
import { Reflect } from "can";
const dateType = {
[Symbol.for("can.new")](value) {
return new Date(value);
},
[Symbol.for("can.isMember")](value) {
return value instanceof Date;
}
};
let val = Reflect.convert("12/02/1355", dateType);
console.log(val); // -> Date{12/02/1355}