@metreeca/blue - v0.9.1
    Preparing search index...

    Module boolean

    Boolean shape model and factories.

    Defines shapes and factories for validating boolean values, mapping the JSON boolean type to the XSD 1.1 boolean datatype.

    XSD Datatype ¹ Factory Description Range
    boolean boolean binary-valued logic {true, false}

    ¹ XSD 1.1 datatypes are referenced by RDF 1.1 and JSON-LD 1.1 as normative * Compatibility

    JSON XSD JavaScript
    true, false {true, false, 1, 0} ¹ true, false

    ¹ Canonical form: true, false

    Defining Boolean Shapes

    import { boolean } from '@metreeca/blue';

    const flag = boolean(); // default model: false
    const enabled = boolean({ model: true }); // custom model value

    Using in Resource Shapes

    import { resource, required, optional, boolean } from '@metreeca/blue';

    const Product = resource({
    available: required(boolean()),
    featured: optional(boolean())
    });

    Interfaces

    BooleanShape

    Shape definition for boolean values.

    BooleanConstraints

    Constraints for the boolean shape factory.

    Guards

    isBooleanShape

    Checks whether a value is a BooleanShape.

    isBooleanConstraints

    Checks whether a value is a valid BooleanConstraints object.

    Factories

    boolean

    Creates a boolean shape.