0.1.0 • Published 7 years ago

kerchief-parser v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

NodeJS Kerchief Parser

Build Status Dependency status codecov Code Climate XO code style

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 message
  • testResult: the complete Kerchief message
  • invalidMessage: 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