DoneJS StealJS jQuery ++ FuncUnit DocumentJS
3.0.0
2.3.27

 

  • Github
  • Twitter
  • Chat
  • Forum
  • Guides
  • Core
  • Ecosystem
  • Infrastructure
  • Legacy
    • can-ejs
    • can-list
    • can-map
    • can-map-backup
    • can-map-define
      • Type
      • Value
      • type
      • attribute definition
      • get
      • remove
      • serialize
      • set
      • value
    • can-view-href
  • Bitovi
    • Bitovi.com
    • Blog
    • Consulting
    • Training
    • Open Source
  • Chat
  • Forum
  • Star
  • Follow @canjs
  • CanJS
  • /
  • Legacy
  • /
  • can-map-define
  • /
  • Type
  • / On this page
    • Type

      function

      Provides a constructor function to be used to convert any value passed into attr into an appropriate value

      • source

      constructorFunc

      A constructor function can be provided that is called to convert incoming values set on this property, like:

      define: {
        prop: {
          Type: Person
        }
      }
      

      Similar to type, this uppercase version provides a mechanism for converting incoming values to another format or type.

      Specifically, this constructor will be invoked any time this property is set, and any data passed into the setter will be passed as arguments for the constructor.

      If the call to attr passes an object that is already an instance of the constructor specified with Type, no conversion is done.

      CanJS is part of DoneJS. Created and maintained by the core DoneJS team and Bitovi. Currently 3.0.0.