string-type

the string type object.

Usage no npm install needed!

<script type="module">
  import stringType from 'https://cdn.skypack.dev/string-type';
</script>

README

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