idf2json
v0.1.3
Published
IDF, JSON, and their happy lives together
Downloads
3
Readme
idf2json
IDF, JSON, and their happy lives together
Getting Started
Install the module with: npm install idf2json
var idf2json = new require('idf2json')(options);
Options
Include any of the following options when instantiating:
- idd_path - path to an IDD JSON file, used for annotating IDF files
- idd_index - an in-memory object that represents the IDD in cache for IDF annotating
Methods
idf2json includes the following methods:
- idd_to_json(text) - convert a text IDD into JSON
- idf_to_json(text, options) - convert a text IDF into JSON. Include
options.idd
as an in-memory object to use for IDD annotations. - idd_for_idf(idf, options) - return relevant IDD entries for a given IDF JSON file. Include
options.idd
as an in-memory object to use for IDD annotations. - idd_json_to_xml(json) - convert an IDD JSON object to XML.
- idf_json_to_xml(json) - convert an IDF JSON object to XML.
- parse_file(path, options, callback) - read a text file at
path
, pass the resulting transformed JSON tocallback
. Includeoptions.type = 'idd'
for an IDD, otherwise defaults to an IDF. Includeoptions.format = 'xml'
to pass XML instead of JSON. - write_file(input_path, output_path, options, callback) - read a text file at
input_path
, transform it, and write tooutput_path
. Includeoptions.type = 'idd'
for an IDD, otherwise defaults to an IDF. Includeoptions.format = 'xml'
to transform to XML instead of JSON.
License
Copyright (c) 2014 Buildlab All Rights Reserved.