diff --git a/features.js b/features.js index e2b9bdf..54e6b1b 100755 --- a/features.js +++ b/features.js @@ -1027,6 +1027,29 @@ var FeatureSetProto = { }) }, + + // Generate a Graphviz graph from features... + // + // XXX experimental... + gvGraph: function(lst, dep){ + lst = lst || this.features + dep = dep || this + + var graph = '' + graph += 'digraph ImageGrid {\n' + lst.forEach(function(f){ + var deps = dep[f] || [] + + deps.length > 0 ? + deps.forEach(function(d){ + graph += `\t"${f}" -> "${d}";\n` }) + : (graph += `\t"${f}";\n`) + }) + graph += '}' + + return graph + }, + // shorthand for: Feature(, ...) Feature: function(){ return this.__feature__.apply(null, [this].concat(args2array(arguments))) }, diff --git a/package.json b/package.json index 9d7f318..ee384b5 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ig-features", - "version": "3.2.2", + "version": "3.2.3", "description": "", "main": "features.js", "scripts": {