Add option plugins with name(s) of node modules or relative JavaScript files to be loaded
A plugin (aka rule engine) gets the external rule (string or object) and returns a rule checker. A rule checker is a function that gets a record/field/subfield and returns a (possibly empty) array of errors. An error is a JSON object with keys message. Additional keys error (rule id), tag, occurrence, are set automatically by caller.
Rules at upper level Avram elements are initialized first, so in this case:
Extensions are included in 0.6.2 (not live loading yet). Additional method loadRule returning an object with methods checkRecord, checkField, checkSubfield should be implemented.
Requires a method to load/supply code via plugins and/or a ruleLoader.
xsd:nonNegativeInteger
) to executable codeplugins
with name(s) of node modules or relative JavaScript files to be loadedA plugin (aka rule engine) gets the external rule (string or object) and returns a rule checker. A rule checker is a function that gets a record/field/subfield and returns a (possibly empty) array of errors. An error is a JSON object with keys
message
. Additional keyserror
(rule id),tag
,occurrence
, are set automatically by caller.Rules at upper level Avram elements are initialized first, so in this case:
The rule engine knows about
{ "id": "x-rule", .. }
first so it can use"x-rule"
as reference to the former rule.