0.1.1 • Published 3 years ago
boolean-type v0.1.1
boolean-type
The boolean type info object.
Usage
import { BooleanType } from 'boolean-type'
var b = new BooleanType('true', {
boolNames: {
false: ['false', 'no', 'wrong']
true: ['true', 'yes', 'ok']
}
})
//or b= Bool.create('yes')
//or b= Bool.create('ok')
console.log(String(b))
//=true
console.log(b.isValid())
//=true
console.log(s.toJson()))
//="true"
console.log(s.toJson({withType:true})))
//='{"value":"true","name":"Boolean","boolNames":{"false":["false","no","wrong"],"true":["true","yes","ok"]}}'
n.assign('w')
//=TypeError: "w" is an invalid Boolean
n.assign('wrong')
//n.valueOf()=false
API
See abstract-type
TODO
License
MIT
2.0.0-alpha.1
3 years ago
2.0.0-alpha.2
3 years ago
2.0.0-alpha.0
3 years ago
0.1.1
8 years ago
0.1.0
9 years ago