Skip to content

Latest commit

 

History

History

brocanfile

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

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.