idf2json

0.1.3 • Public • Published

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 to callback. Include options.type = 'idd' for an IDD, otherwise defaults to an IDF. Include options.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 to output_path. Include options.type = 'idd' for an IDD, otherwise defaults to an IDF. Include options.format = 'xml' to transform to XML instead of JSON.

License

Copyright (c) 2014 Buildlab All Rights Reserved.

Readme

Keywords

none

Package Sidebar

Install

npm i idf2json

Weekly Downloads

5

Version

0.1.3

License

none

Last publish

Collaborators

  • sackio