kerchief-parser
v0.1.0
Published
Node Kerchief Parser
Downloads
5
Readme
NodeJS Kerchief Parser
A streaming nodejs Kerchief parser, which validates every message against the JSON schema. Currently up to Kerchief spec draft 01.
Getting Started
Prerequisites
The Kerchief parser assumes a NodeJS environment. So go ahead and make sure you've got that setup, as well as yarn.
Installing
Add Kerchief parser as a dependency:
$ yarn add kerchief-parser
Cool. Now, use it:
const Parser = require('kerchief-parser');
const kerchiefParser = new Parser();
kerchiefParser.on('testStarted', testStarted => {
console.log(testStarted);
});
kerchiefParser.write(JSON.stringify({
testStarted: {
name: "This is my test!",
id: "5226c9ce-0dc8-4ca5-95f7-23016716be70"
}
}));
The parser may emit three different types of event:
testStarted
: the complete Kerchief messagetestResult
: the complete Kerchief messageinvalidMessage
: a TypeError (which your consumer may then throw, if needed).
Running the tests
$ yarn test
Contributing
Pull requests welcome!
Versioning
We use SemVer for versioning.
License
This project is licensed under the MIT License - see the LICENSE file for details