Skip to content

Commit 248a221

Browse files
committed
Refactor style
1 parent 7a59fd6 commit 248a221

File tree

6 files changed

+15
-16
lines changed

6 files changed

+15
-16
lines changed

index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ function toMdast(tree, options) {
4343
return augment(node, result)
4444
}
4545

46-
/* `right` is the finalized mdast node,
47-
* created from `left`, a hast node */
46+
// `right` is the finalized mdast node, created from `left`, a hast node.
4847
function augment(left, right) {
4948
if (left.position) {
5049
right.position = left.position

lib/handlers/list-item.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function listItem(h, node) {
1313
var grandchildren
1414
var content
1515

16-
/* Check if this node starts with a checkbox. */
16+
// Check if this node starts with a checkbox.
1717
if (head && is(head, 'p')) {
1818
grandchildren = head.children
1919
checkbox = grandchildren[0]
@@ -29,13 +29,13 @@ function listItem(h, node) {
2929

3030
content = wrapChildren(h, node)
3131

32-
/* Remove initial spacing if we previously found a checkbox. */
32+
// Remove initial spacing if we previously found a checkbox.
3333
if (checked !== null) {
3434
grandchildren = content[0] && content[0].children
3535
head = grandchildren && grandchildren[0]
3636

3737
if (head && head.type === 'text' && head.value.charAt(0) === ' ') {
38-
/* Remove text with one space, or remove that one initial space */
38+
// Remove text with one space, or remove that one initial space.
3939
if (head.value.length === 1) {
4040
content[0].children = grandchildren.slice(1)
4141
} else {
@@ -44,7 +44,7 @@ function listItem(h, node) {
4444
}
4545
}
4646

47-
/* Drop empty paragraph. */
47+
// Drop empty paragraph.
4848
if (content.length === 1) {
4949
head = content[0]
5050

lib/handlers/media.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function media(h, node) {
3030

3131
visit({type: 'root', children: nodes}, 'link', findLink)
3232

33-
/* If the content links to something, or if it’s not phrasing... */
33+
// If the content links to something, or if it’s not phrasing...
3434
if (linkInFallbackContent || needed(nodes)) {
3535
return nodes
3636
}

lib/handlers/table.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function table(h, node) {
1010
return h(node, 'table', {align: align}, patch(all(h, node), align.length))
1111
}
1212

13-
/* Infer the alignment of the table. */
13+
// Infer the alignment of the table.
1414
function alignment(node) {
1515
var align = []
1616

@@ -30,7 +30,7 @@ function alignment(node) {
3030
}
3131
}
3232

33-
/* Count cells in `parent` before `node`. */
33+
// Count cells in `parent` before `node`.
3434
function cellsBefore(parent, node) {
3535
var children = parent.children
3636
var length = children.length
@@ -54,12 +54,12 @@ function cellsBefore(parent, node) {
5454
return pos
5555
}
5656

57-
/* Check if `node` is a cell. */
57+
// Check if `node` is a cell.
5858
function cell(node) {
5959
return node.tagName === 'th' || node.tagName === 'td'
6060
}
6161

62-
/* Ensure the amount of cells in a row matches `align.left`. */
62+
// Ensure the amount of cells in a row matches `align.left`.
6363
function patch(rows, count) {
6464
var length = rows.length
6565
var index = -1

lib/util/wrap.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ wrap.needed = needed
66

77
var phrasing = require('mdast-util-phrasing')
88

9-
/* Wrap all inline runs of mdast content in `paragraph` nodes. */
9+
// Wrap all inline runs of mdast content in `paragraph` nodes.
1010
function wrap(nodes) {
1111
var result = []
1212
var length = nodes.length
@@ -48,9 +48,9 @@ function wrap(nodes) {
4848
}
4949
}
5050

51-
/* Check if there are non-inline mdast nodes returned.
52-
* This is needed if a fragment is given, which could just be
53-
* a sentence, and doesn’t need a wrapper paragraph. */
51+
// Check if there are non-inline mdast nodes returned. This is needed if a
52+
// fragment is given, which could just be a sentence, and doesn’t need a
53+
// wrapper paragraph.
5454
function needed(nodes) {
5555
var length = nodes.length
5656
var index = -1

test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ test('fixtures', function(t) {
123123

124124
var tree = remove(fromHTML.runSync(fromHTML.parse(input)), true)
125125

126-
/* Replace middots with spaces (useful for break nodes). */
126+
// Replace middots with spaces (useful for break nodes).
127127
output = output.replace(/·/g, ' ')
128128

129129
st.doesNotThrow(function() {

0 commit comments

Comments
 (0)