Skip to content

Schemas And Types

Justin Meyer edited this page Sep 16, 2021 · 9 revisions

getSchema

Map types:

{
   type: "map",
   keys: {
     name: MaybeString
     id: MaybeNumber
   }
}

List Types

{
  type: "list",
  values: String
  keys: {
    count: Number
  }
}

Basic Types

{
  [can.isMember](value){
     return // if `value` is an instance of the type
  }
  [can.new](value) {
     return // make an instance of the type given value
  }
  [can.serialize](value) {
     return // an JSON.stringify() representation of the instance
  }
}

Clone this wiki locally