Home

Awesome

deps-graph

NPM version Build Status Coverage Status Dependency Status

This module constructs dependency graph of blocks, constructed with BEM objects. It relies on require and expect properties in BEM objects to build connections between blocks.

require and expect should be Array of BEMObjects.

API

DepsGraph([parent])

Constructor. Can accept parent DepsGraph.

DepsGraph.add(BEMObject...)

Returns: nothing

Stores BEM object in graph.

DepsGraph.deps(bem)

Type: Object
Returns: Array of BEM objects.

Gets all dependencies for block. Returns dependencies in order, that defined by require and expect of corresponding BEM objects and levels of declaration.

It will throw NotFound exception, when path or any block in dependencies of blocks is not found.

License

MIT (c) 2014 Vsevolod Strukchinsky, Vladimir Starkov