1.0.1 • Published 7 years ago

@brocan/brocanfile v1.0.1

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

brocanfile

Brocanfile parser and validator for Node.

Please see brocanfile.md for the brocanfile reference.

Usage

const brocanfile = require('brocanfile');

brocanfile.read('brocan.hjson')
    .then(contents => console.log(contents));

API

read(filename: string): Promise<any>

Reads the specified file and then parses and validates its contents. Throws an Error if

  • the file cannot be opened or read,
  • the contents of the file are not valid HJSON,
  • the contents of the file violate the brocanfile specification.

In the latter case, the thrown Error instance has a validationErrors field containing the array of constraint violations.