Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
@bem.decl: parse declaration
node v10.24.1
version:
1.0.2
endpoint
share
tweet
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