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
graph: Naturalize graph
node v10.24.1
version:
1.0.2
endpoint
share
tweet
const { BemGraph } = require('@bem/sdk.graph'); const BemCell = require('@bem/sdk.cell'); const graph = new BemGraph(); graph.vertex({ block: 'a' }) .dependsOn({ block: 'b', elem: 'el' }); graph.vertex({ block: 'b' }); graph.dependenciesOf({block: 'a'}); // => [ // { "entity": {"block": "b", elem: "el"}}, // { "entity": {"block": "a"}} // ]
After the graph was naturalized.
graph.naturalize(); graph.dependenciesOf({block: 'a'}); // => [ // { "entity": {"block": "b"}}, // { "entity": {"block": "b", elem: "el"}}, // { "entity": {"block": "a"}} // ]
Loading…
no comments
sign in
to comment