Skip to content

Commit

Permalink
Fix example to use ESM
Browse files Browse the repository at this point in the history
Closes GH-22.

Reviewed-by: Titus Wormer <tituswormer@gmail.com>
  • Loading branch information
coderaiser committed Apr 20, 2021
1 parent cd4f350 commit a14d311
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions readme.md
Expand Up @@ -24,17 +24,17 @@ npm install unist-util-visit
## Use

```js
var u = require('unist-builder')
var visit = require('unist-util-visit')
import {u} from 'unist-builder'
import {visit} from 'unist-util-visit'

var tree = u('tree', [
const tree = u('tree', [
u('leaf', '1'),
u('node', [u('leaf', '2')]),
u('void'),
u('leaf', '3')
])

visit(tree, 'leaf', function(node) {
visit(tree, 'leaf', (node) => {
console.log(node)
})
```
Expand Down

0 comments on commit a14d311

Please sign in to comment.