$ npm install --save-dev @bem/deps
var bemDeps = require('@bem/deps'),
toArray = require('stream-to-array');
toArray(bemDeps.load({ levels: ['blocks'] }), function (err, relations) {
var declaration = [{ block: 'a' }],
res = bemDeps.resolve(declaration, relations, { tech: 'js' });
console.log(JSON.stringify(res, null, 4));
});
// {
// "entities": [
// { "block": "c" },
// { "block": "a" },
// { "block": "b" }
// ],
// "dependOn": [
// {
// "tech": "bemhtml",
// "entities": [
// { "block": "d" }
// ]
// }
// ]
// }
Code and documentation copyright 2015 YANDEX LLC. Code released under the Mozilla Public License 2.0.