0.1.2 • Published 9 years ago

string-type v0.1.2

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

string-type npm

Build Status Code Climate Test Coverage downloads license

The string type info object.

Usage

var StringType  = require('string-type')
var Str = StringType(min:1, max:6)
var s = Str.create('a str')
console.log(s+ '!')
//='a str!'
console.log(s.isValid())
//=true
console.log(s.toJson()))
//='"a str"'
console.log(s.toJson({withType:true})))
//='{"value":'a str',"name":"String","min":1,"max":6}'
n.assign('1234567')
//=TypeError: "1234567" is an invalid String
n.assign('123456')
//="123456"

API

See abstract-type

TODO

License

MIT