Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
lib
test
CHANGELOG.md
LICENSE.txt
README.md
package.json

README.md

deps

NPM Status

Install

$ npm install --save-dev @bem/sdk.deps

Usage

var bemDeps = require('@bem/sdk.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" }
//             ]
//         }
//     ]
// }

License

Code and documentation copyright 2015-2017 YANDEX LLC. Code released under the Mozilla Public License 2.0.