- Commit
- 1f5e01bbacb790f8e1159d91d430e7bc023ffc98
- Parent
- 977a9dd1cd0e5574799211d697b0889431fc0876
- Author
- John MacFarlane <jgm@berkeley.edu>
- Date
Use a switch instead of if-then-else.
My personal build of CMark ✏️
Use a switch instead of if-then-else.
1 file changed, 6 insertions, 5 deletions
Status | File Name | N° Changes | Insertions | Deletions |
Modified | js/lib/html.js | 11 | 6 | 5 |
diff --git a/js/lib/html.js b/js/lib/html.js @@ -228,15 +228,16 @@ var renderNodes = function(block, options) { }; var sub = function(s) { - if (s === '&') { + switch (s) { + case '&': return '&'; - } else if (s === '<') { + case '<': return '<'; - } else if (s === '>') { + case '>': return '>'; - } else if (s === '"') { + case '"': return '"'; - } else { + default: return s; } };