dependency-cruiser
Version:
Visualize and validate javascript dependencies. With your rules. ES6, CommonJS, AMD
30 lines (23 loc) • 831 B
JavaScript
;
const Handlebars = require("handlebars/dist/cjs/handlebars.runtime");
const dependencyToIncidenceTransformer = require("./dependencyToIncidenceTransformer");
require("./html.template");
function addShowTitle(pDependencyEntry) {
return {
source: pDependencyEntry.source,
incidences: pDependencyEntry.incidences.map(pIncidence => {
return {
incidence: pIncidence.incidence,
to: pIncidence.to,
hasRelation: pIncidence.incidence !== "false"
};
})
};
}
function render(pInput) {
return Handlebars.templates['html.template.hbs']({
"things" : dependencyToIncidenceTransformer.transform(pInput).map(addShowTitle)
});
}
exports.render = render;
/* eslint arrow-body-style: 0 */