Skip to content

Latest commit

 

History

History
79 lines (60 loc) · 2.18 KB

API.md

File metadata and controls

79 lines (60 loc) · 2.18 KB

Classes

Document

Functions

bundle(files, options)Document

Document

Kind: global class

new Document(parsedJSONList, [base])

Param Type
parsedJSONList Array.<Object>
[base] Object

Example

const document = new Document(parsedJSONList, base);

console.log(document.json()); // get json object
console.log(document.yml()); // get yaml string
console.log(document.string()); // get json string

document.json() ⇒ Object

Kind: instance method of Document

document.yml() ⇒ string

Kind: instance method of Document

document.string() ⇒ string

Kind: instance method of Document

bundle(files, options) ⇒ Document

Kind: global function

Param Type Description
files Array.<string> | Array.<Object> files that are to be bundled
options Object
options.base string | object base object whose prperties will be retained.
options.parser Object asyncapi parser object
options.validate boolean pass false to not validate file before merge

Example

const bundler = requrie('@asyncapi/bundler');
const fs = require('fs');
const path = requrie('path');

const document = await bundler.bundle(fs.readFileSync(
  path.resolve('./asyncapi.yaml', 'utf-8')
));

console.log(document.yml());