a tree language.
yarn add @saber2pr/tree-lang
- code like this
parent1
child1
parent2
child1
child2
parent3
child1
childd1
- parse
import parse from "@saber2pr/tree-lang"
parse(code)
/*
{
name: "root",
children: [
{
name: "parent1",
children: [
{
name: "child1"
}
]
},
{
name: "parent2",
children: [
{
name: "child1"
},
{
name: "child2"
}
]
},
{
name: "parent3",
children: [
{
name: "child1",
children: [
{
name: "childd1"
}
]
}
]
}
]
}
*/
yarn install
yarn start
yarn test
Author: saber2pr