decentralized-internet
Version:
An NPM library of programs to create decentralized web and distributed computing projects
1 lines • 502 B
JavaScript
;const Any=require("./any"),internals={};internals.Boolean=class extends Any{constructor(){super(),this._type="boolean"}_base(e,n,o){const r={value:e};if("string"==typeof e&&o.convert){const n=e.toLowerCase();r.value="true"===n||"yes"===n||"on"===n||"1"===n||"false"!==n&&"no"!==n&&"off"!==n&&"0"!==n&&e}return"number"==typeof e&&o.convert&&(r.value=1===e||0!==e&&e),r.errors="boolean"==typeof r.value?null:this.createError("boolean.base",null,n,o),r}},module.exports=new internals.Boolean;