silfverorg / duns.js

Javascript schema validator
5 stars 2 forks source link

Added Duns.bool(). Closes #33. #45

Closed silfverstrom closed 9 years ago

silfverstrom commented 9 years ago

Duns.bool() validates either exactly true or exactly false values. Duns.bool extends Duns.any and has two additional methods.

Example,

    var schema = Duns.bool();
    schema.validate(true); // true
    schema.validate(false); // true

    var schema = Duns.bool().mustBeTrue();
    schema.validate(true); // true
    schema.validate(false); // false

    var schema = Duns.bool().mustBeFalse();
    schema.validate(false); // true
    schema.validate(true); // false