From d30b18fca6556823ab937358a999961e2dd6dd4e Mon Sep 17 00:00:00 2001 From: daniel-j Date: Tue, 11 Apr 2017 22:01:25 +0200 Subject: [PATCH] Handle errors in word counter. Fixes #17 --- src/html-wordcount.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/html-wordcount.js b/src/html-wordcount.js index 8a201e0..20dc931 100644 --- a/src/html-wordcount.js +++ b/src/html-wordcount.js @@ -8,5 +8,9 @@ export default function htmlWordCount (html) { ignoreHref: true }) - return matchWords(text).length + let count = 0 + try { + count = matchWords(text).length + } catch (err) {} + return count }