object-type
The Object type can hold the attributes of the object.
- Object Type Attributes:
attributes
(object): this object's attribute list.strict
(boolean): whether treat this object as strict mode. defaults to false.- the object can only have attributes in the attributes list if strict mode is enabled.
Usage
//register the string and number types: var ObjectType = var Obj = //=<type "Object": "attributes":{"s":"String","n":{"required":true,"type":"Number"}},"strict":true>var value = Obj//=<type "Object": "attributes":{"s":"String","n":{"required":true,"type":"Number"}},"strict":true,"value":{"s":"123","n":33}>value = Obj//=TypeError: "[object Object]" is an invalid Objectconsole//=[ { name: 'n', message: 'is required' } ]Obj//=falseconsole//[ { name: 's', message: 'is invalid' },// { name: 'n', message: 'is required' } ]
API
See abstract-type.
TODO
License
MIT