An implementation of the HRX spec in JavaScript for NodeJS.
This uses negative lookbehinds in regular expressions so you have to use a relatively recent version of NodeJS.
The only method exposed by hrx.js
is parse_hrx
at top-level.
const parse_hrx = require('./hrx.js');
This takes in a string containing the contents of an appropriate file, and returns an array.
const [hrx_parsed, errs] = parse_hrx(contents);
The errs
entry contains an array of errors encountered while parsing.
The hrx_parsed
entry is a JSON object that is appropriate for consumption with MemFS.
The difference between this version and the Python version is that the array of errors is just a set of strings that describe the fault. You should keep in mind to check the length of the error result.