cmark

My personal build of CMark ✏️

Commit
d012cefdee6235e107372dd939498a0ca107d7e0
Parent
8613437393d1e6cdb81d7bc3a94760a5faba3601
Author
John MacFarlane <jgm@berkeley.edu>
Date

node.js: use switch instead of if-else.

Diffstat

1 file changed, 15 insertions, 11 deletions

Status File Name N° Changes Insertions Deletions
Modified js/lib/node.js 26 15 11
diff --git a/js/lib/node.js b/js/lib/node.js
@@ -1,17 +1,21 @@
 "use strict";
 
 function isContainer(node) {
-    var t = node.t;
-    return (t === 'Document' ||
-            t === 'BlockQuote' ||
-            t === 'List' ||
-            t === 'ListItem' ||
-            t === 'Paragraph' ||
-            t === 'Header' ||
-            t === 'Emph' ||
-            t === 'Strong' ||
-            t === 'Link' ||
-            t === 'Image');
+    switch (node.t) {
+    case 'Document':
+    case 'BlockQuote':
+    case 'List':
+    case 'ListItem':
+    case 'Paragraph':
+    case 'Header':
+    case 'Emph':
+    case 'Strong':
+    case 'Link':
+    case 'Image':
+        return true;
+    default:
+        return false;
+    }
 }
 
 var resumeAt = function(node, entering) {