FT
Runtime Type Check System For Javascript
Install
npm install flyber-types
Type Definition Example ('./examples/System.ft')
#Simple Types String : /.?/ Integer : GlobalInteger Int : Integer Boolean : GlobalBoolean Bool : Boolean Double : GlobalDouble Numeric : Double | Integer Null : GlobalNull Undefined : GlobalUndefined Email : /^[-a-z0-9~!$%^&*_=+}{\'?]+*@?$/i Strings : String #Type Extensions String...Min min : /^.{#{min},}$/Max max : /^.{,#{max}}$/Range min max : /^.{#{min},#{max}}$/ Integer...Min min : @ >= minMax max : @ <= max #Enums Status : "active" | "inactive" Missing : Null | Undefined #Complex Types User------------email : Emailpicture : Stringfirstname : String Range520lastname : String status : Statusbio : String | Missingtags : String
Use
var types = ; var fs = ; var validate = ; var user = email: 'a.stegno@gmail.com' picture: 'http://some-website.com/picture.png' firstname: 'Andrey' lastname: 'Test' status: 'active' bio: 'Ho' tags: "user" ; ; //true