@bem.decl: parse declaration

node v10.24.1
version: 1.0.2
endpointsharetweet
const bemDecl = require('@bem/sdk.decl'); const stringDecl = "exports.deps = [{ block: 'a'}, { block: 'b', elem: '1'}]"; bemDecl.parse(stringDecl).map(c => c.id);
Pass the same declaration as an object.
const objDecl = { deps: [ { block: 'a'}, { block: 'b', elem: '1'} ] }; bemDecl.parse(objDecl).map(c => c.id);
Pass declaration in "v1" format.
const decl_v1 = "exports.blocks = [{ name: 'a'}, { name: 'b', elems: [{ name: '1'}, { name: '2'}]}]"; bemDecl.parse(decl_v1).map(c => c.id);
Loading…

no comments

    sign in to comment