array-type
The array type. See the type-info for type info collections.
Usage
//register the array type to the TypeInfo..var TypeInfo = //get the array type info:var ArrayType = /*//Just load array type only:var ArrayTypeInfo = require('array-type')var ArrayType = ArrayTypeInfo() */var LimitedArrayType = var arr = ArrayType//var arr = ArrayType.createValue([1,2,3]) //it's the same. console//<type "array": "value":[1,2,3]>console//=trueconsole)//='[1,2,3]'console)//='{"value":[1,2,3],"name":"array"}'console//=falseconsole//=truevar n = arr;n//=TypeError: "aaa" is an invalid array
API
- The ArrayType Class
- options:
- min: the minimum length of the array. null or undefined means unlimited.
- max: the maximum length of the array.
- options:
See abstract-type
TODO
of
option to limit the element's type.- eg,
ArrayType of: 'String'
- eg,
License
MIT