Skip to content

Commit

Permalink
chore(README) : updated TOC
Browse files Browse the repository at this point in the history
  • Loading branch information
brucou committed Jul 16, 2018
1 parent 40f46d3 commit 0eb005c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -760,3 +760,20 @@ The corresponding lenses would be as follows :
```

Cf. tests for concrete examples.

## Array-stored trees
Self-evident from the lenses definitions, a tree is `label || [label, children]` :

```javascript
export const arrayTreeLenses = {
getLabel: tree => {
return Array.isArray(tree) ? tree[0] : tree
},
getChildren: tree => {
return Array.isArray(tree) ? tree[1] : []
},
constructTree: (label, children) => {
return children && Array.isArray(children) ? [label, children] : label
},
}
```

0 comments on commit 0eb005c

Please sign in to comment.