From e080a3f856aa47a368a7e71d1f74499b1daea077 Mon Sep 17 00:00:00 2001 From: azu Date: Fri, 27 Jan 2023 15:21:49 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20tokenize=E3=81=AE=E7=B5=90=E6=9E=9C?= =?UTF-8?q?=E3=81=8C=E7=A9=BA=E3=81=AE=E5=A0=B4=E5=90=88=E3=81=AB=E3=82=A8?= =?UTF-8?q?=E3=83=A9=E3=83=BC=E3=81=A8=E3=81=AA=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/no-dropping-i.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/no-dropping-i.js b/src/no-dropping-i.js index ab18001..d4c147a 100644 --- a/src/no-dropping-i.js +++ b/src/no-dropping-i.js @@ -21,7 +21,12 @@ module.exports = function(context) { } const text = getSource(node); return tokenize(text).then(tokens => { - tokens.reduce((prev, current) => { + tokens.forEach((token, index) => { + const current = token; + const prev = tokens[index - 1]; + if (!prev || !current) { + return; + } if (isTargetWord(prev) && isMasuWord(current)) { report( node, @@ -30,7 +35,6 @@ module.exports = function(context) { }) ); } - return current; }); }); }