Comparing version 0.9.0 to 0.9.1
23
index.js
'use strict'; | ||
var pcnlint = require('pcnlint'); | ||
var LayoutGraph = require('./lib/layout/LayoutGraph'); | ||
var svgBuilder = require('./lib/svg/builder'); | ||
var xmlBuilder = require('./lib/xml/builder'); | ||
module.exports = function(pcn) { | ||
var layoutGraph = new LayoutGraph(pcn); | ||
var root = svgBuilder(pcn.metadata.title, layoutGraph); | ||
var cleanData; | ||
try { | ||
if (typeof pcn === 'object') { | ||
pcnlint.testDocument(JSON.stringify(pcn)); | ||
cleanData = pcn; | ||
} else if (typeof pcn === 'string') { | ||
pcnlint.testDocument(pcn); | ||
cleanData = JSON.parse(pcn); | ||
} else { | ||
throw new Error('Unsupported input to pcnchart. Must be object or JSON string.'); | ||
} | ||
} catch (e) { | ||
throw new Error('PCN Input Invalid - ' + e.message); | ||
} | ||
var layoutGraph = new LayoutGraph(cleanData); | ||
var root = xmlBuilder(cleanData.metadata.title, layoutGraph); | ||
return root.toString(); | ||
}; | ||
{ | ||
"name": "pcnchart", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"description": "Create an SVG string to display Process Chain Network data", | ||
@@ -15,4 +15,6 @@ "main": "index.js", | ||
"author": "tgroshon", | ||
"repository": "git@github.com:tgroshon/pcnchart.git", | ||
"license": "MIT", | ||
"dependencies": { | ||
"pcnlint": "^0.5.0", | ||
"xmlbuilder": "^2.4.5" | ||
@@ -19,0 +21,0 @@ }, |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
49538
26
1900
2
+ Addedpcnlint@^0.5.0
+ Addedassertion-error@1.0.0(transitive)
+ Addedchai@1.10.0(transitive)
+ Addeddeep-eql@0.1.3(transitive)
+ Addedget-stdin@3.0.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedpcnlint@0.5.0(transitive)
+ Addedtype-detect@0.1.1(transitive)