Skip to content

Commit 3f1c7d6

Browse files
committed
Refactor code-style
1 parent 3e3d885 commit 3f1c7d6

File tree

6 files changed

+11
-16
lines changed

6 files changed

+11
-16
lines changed

lib/handlers/image-reference.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function imageReference(h, node) {
1010
var def = h.definition(node.identifier);
1111
var props = {src: normalize((def && def.url) || ''), alt: node.alt};
1212

13-
if (def && def.title != null) {
13+
if (def && def.title !== null && def.title !== undefined) {
1414
props.title = def.title;
1515
}
1616

lib/handlers/image.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = image;
88
function image(h, node) {
99
var props = {src: normalize(node.url), alt: node.alt};
1010

11-
if (node.title != null) {
11+
if (node.title !== null && node.title !== undefined) {
1212
props.title = node.title;
1313
}
1414

lib/handlers/link-reference.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function linkReference(h, node) {
1111
var def = h.definition(node.identifier);
1212
var props = {href: normalize((def && def.url) || '')};
1313

14-
if (def && def.title != null) {
14+
if (def && def.title !== null && def.title !== undefined) {
1515
props.title = def.title;
1616
}
1717

lib/handlers/link.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = link;
99
function link(h, node) {
1010
var props = {href: normalize(node.url)};
1111

12-
if (node.title != null) {
12+
if (node.title !== null && node.title !== undefined) {
1313
props.title = node.title;
1414
}
1515

lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function factory(tree, options) {
6565
/* Create an element for a `node`. */
6666
function h(node, tagName, props, children) {
6767
if (
68-
children == null &&
68+
(children === undefined || children === null) &&
6969
typeof props === 'object' &&
7070
'length' in props
7171
) {

package.json

+6-11
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
"util",
99
"hast"
1010
],
11-
"files": [
12-
"lib",
13-
"index.js"
14-
],
15-
"repository": "https://github.com/syntax-tree/mdast-util-to-hast",
11+
"repository": "syntax-tree/mdast-util-to-hast",
1612
"bugs": "https://github.com/syntax-tree/mdast-util-to-hast/issues",
1713
"author": "Titus Wormer <[email protected]> (http://wooorm.com)",
1814
"contributors": [
1915
"Titus Wormer <[email protected]> (http://wooorm.com)"
2016
],
17+
"files": [
18+
"lib",
19+
"index.js"
20+
],
2121
"dependencies": {
2222
"collapse-white-space": "^1.0.0",
2323
"detab": "^2.0.0",
@@ -54,12 +54,7 @@
5454
"space": true,
5555
"esnext": false,
5656
"rules": {
57-
"guard-for-in": "off",
58-
"eqeqeq": [
59-
"off",
60-
"allow-null"
61-
],
62-
"no-eq-null": "off"
57+
"guard-for-in": "off"
6358
},
6459
"ignores": [
6560
"mdast-util-to-hast.js"

0 commit comments

Comments
 (0)