Utility for operations with deps.js entities.
$ npm install depsjs
var depsjs = require('depsjs');
var first = {mustDeps: {block: 'b1', elem: 'e1'}},
second = {mustDeps: {block: 'b1', elems: 'e1'}};
depsjs.difference(first, second); // [{mustDeps: {block: 'b1'}}]
depsjs.intersection(first, second); // [{mustDeps: {block: 'b1', elem: 'e1'}}]
depsjs.subtraction(first, second); // []
depsjs.subtraction(second, first); // [{mustDeps: {block: 'b1'}}]
Note! Each method can accept the third argument – a BEM-entity for which given deps.js
contents are written:
{
block: 'b1',
elem: 'e1',
modName: 'm1',
modVal: 'v1'
}