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 1.0 datatypes are referenced by RDF 1.1 and JSON-LD 1.1 as normative
Compatibility
true
false
¹ Canonical form: true, false
Defining Boolean Shapes
import { boolean } from '@metreeca/blue/boolean';const flag = boolean(); // default model: falseconst enabled = boolean({ model: true }); // custom model value Copy
import { boolean } from '@metreeca/blue/boolean';const flag = boolean(); // default model: falseconst 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())}); Copy
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())});
Shape definition for boolean values.
Constraints for the boolean shape factory.
Creates a boolean shape.
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 1.0 datatypes are referenced by RDF 1.1 and JSON-LD 1.1 as normative
Compatibility
true,falsetrue,false¹ Canonical form:
true,falseDefining Boolean Shapes
Using in Resource Shapes
See