UNPKG

basicprimitives

Version:

Basic Primitives Diagrams for JavaScript - data visualization components library that implements organizational chart and multi-parent dependency diagrams, contains implementations of JavaScript Controls and PDF rendering plugins.

21 lines (17 loc) 753 B
export default function BaseTransformer(debug) { this.debug = debug; }; BaseTransformer.prototype.validate = function (logicalFamily, strongValidate) { /* test consistency of references in family tree */ if (!logicalFamily.validate()) { throw "Family structure failed to pass validation!"; } logicalFamily.loop(this, function (famItemId, famItem) { logicalFamily.loopChildren(this, famItemId, function (childid, child, level) { if (child.level === null || famItem.level === null || (strongValidate ? child.level != famItem.level + 1 : child.level <= famItem.level)) { throw "Family tree is broken. Children/Parents or levels mismatch!"; } return logicalFamily.SKIP; }); }); };