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

    Module boolean

    Boolean shape and factories.

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

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

    ¹ XSD 1.0 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/boolean';

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

    Using in Resource Shapes

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

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

    Interfaces

    BooleanShape

    Shape definition for boolean values.

    BooleanConstraints

    Constraints for the boolean shape factory.

    Functions

    boolean

    Creates a boolean shape.