summaryrefslogtreecommitdiff
path: root/js/lib
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-01-11 13:11:40 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-01-11 13:11:40 -0800
commitd012cefdee6235e107372dd939498a0ca107d7e0 (patch)
tree2567c09c7c4b0053c29cf999672e6d5ae1f70689 /js/lib
parent8613437393d1e6cdb81d7bc3a94760a5faba3601 (diff)
node.js: use switch instead of if-else.
Diffstat (limited to 'js/lib')
-rw-r--r--js/lib/node.js26
1 files changed, 15 insertions, 11 deletions
diff --git a/js/lib/node.js b/js/lib/node.js
index 9dc7c3f..ae02838 100644
--- 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) {