From d012cefdee6235e107372dd939498a0ca107d7e0 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 11 Jan 2015 13:11:40 -0800 Subject: node.js: use switch instead of if-else. --- js/lib/node.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'js') 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) { -- cgit v1.2.3