Fieldset ยป enforceAllElements

enforceAllElements()
enforceAllElements(enforce)

Set the default for all following queries on this fieldset of whether the presence of elements in the eno input text should be enforced (by default it is not). This can be used to prevent "template decay" - with presence enforcement enabled entries may be empty, but they (at least their declaration) must be there in the eno document and consequently they can not disappear from a template at any point without triggering an error.

enoconversions:
0001 = 1
0010 = 2
javascriptconst document = eno.parse(input);

const conversions = document.fieldset('conversions');

conversions.enforceAllElements();

conversions.entry('0011');  // throws an error
conversions.entry('0011', { enforceElement: false });  // returns null

Parameters

enforce

An optional boolean indicating whether to enforce or not. (otherwise true is assumed)