jsonviz
Version:
A Node.js module that converts JSON to DOT language and can create GraphViz graphics with viz.js (without installing GraphViz)
30 lines (24 loc) • 449 B
JavaScript
;
var fs = require("fs");
function SVG(txt)
{
this.text = txt;
}
// ------------ Public Methods ------------ //
SVG.prototype.toString = function()
{
return this.text;
};
SVG.prototype.save = function(path, cb)
{
if(cb === true || cb === undefined)
{
fs.writeFileSync(path, this.text);
}
else
{
fs.writeFile(path, this.text, cb);
}
return this;
};
exports = module.exports = SVG;