Skip to content

Commit b1d1bb3

Browse files
committed
Remove dependency
1 parent eb568b5 commit b1d1bb3

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

index.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
11
'use strict'
22

33
var visit = require('unist-util-visit')
4-
var modify = require('unist-util-modify-children')
54

65
module.exports = compact
76

87
/* Make an MDAST tree compact by merging adjacent text nodes. */
98
function compact(tree, commonmark) {
10-
var modifier = modify(iterator)
11-
129
visit(tree, visitor)
1310

1411
return tree
1512

16-
function visitor(node) {
17-
if (node.children) {
18-
modifier(node)
19-
}
20-
}
21-
22-
function iterator(child, index, parent) {
23-
var siblings = parent.children
13+
function visitor(child, index, parent) {
14+
var siblings = parent ? parent.children : []
2415
var prev = index && siblings[index - 1]
2516

2617
if (

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"index.js"
2020
],
2121
"dependencies": {
22-
"unist-util-modify-children": "^1.0.0",
2322
"unist-util-visit": "^1.1.0"
2423
},
2524
"devDependencies": {

0 commit comments

Comments
 (0)