string-type

0.1.2 • Public • Published

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

Package Sidebar

Install

npm i string-type

Weekly Downloads

1

Version

0.1.2

License

MIT

Last publish

Collaborators

  • riceball