From 33a0c97f476ffaf13084a967356ea453188caadf Mon Sep 17 00:00:00 2001 From: Eugene Kuzmenko Date: Mon, 30 Jan 2017 21:15:46 +0100 Subject: [PATCH] [fixed] small formatting issues in commentsOnly.js --- commentsOnly.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/commentsOnly.js b/commentsOnly.js index e093946..e90166d 100644 --- a/commentsOnly.js +++ b/commentsOnly.js @@ -20,13 +20,9 @@ exports.handlers = { } const comments = source.match(cmt); - if (!comments) { - e.source = source.replace(notN, ''); - - return; - } - - e.source = source.split(cmt).reduce((result, source, i) => result + source.replace(notN, '') + comments[i], ''); + e.source = comments + ? source.split(cmt).reduce((res, src, i) => res + src.replace(notN, '') + comments[i], '') + : source.replace(notN, ''); } };