loaders ยป boolean

boolean() โ†’ boolean
booleanItems() โ†’ array
booleanList() โ†’ array

Accepts true, false, yes and no, returns a boolean (or throws an error for invalid values).

enoenabled: true
publish: no
visible: not
javascriptconst document = eno.parse(input);

document.boolean('enabled');  // returns true
document.boolean('publish');  // returns false

document.boolean('visible');
  // throws an error: 'visible' must contain a boolean - allowed values are 'true', 'false', 'yes' and 'no'.