From 1f49de6901032061b59c4d072a9a6499d099a59f Mon Sep 17 00:00:00 2001 From: JenithaKathirvel Date: Fri, 17 Feb 2017 17:51:51 +0530 Subject: [PATCH 1/2] Update swearjar.js --- lib/swearjar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/swearjar.js b/lib/swearjar.js index 63dbaa6..bba85a9 100644 --- a/lib/swearjar.js +++ b/lib/swearjar.js @@ -6,9 +6,9 @@ var swearjar = { scan: function (text, callback) { var word, key, match; - var regex = /\w+/g + var regex = /\w+/g, nonRegex = /\W+/g; - while (match = regex.exec(text)) { + while (match = (regex.exec(text) || nonRegex.exec(text))) { word = match[0]; key = word.toLowerCase(); From 3132b1e8e99a06ee2daed0d5178c12f17f983e2d Mon Sep 17 00:00:00 2001 From: JenithaKathirvel Date: Fri, 17 Feb 2017 18:32:14 +0530 Subject: [PATCH 2/2] Update swearjar.js --- lib/swearjar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/swearjar.js b/lib/swearjar.js index bba85a9..dee1d03 100644 --- a/lib/swearjar.js +++ b/lib/swearjar.js @@ -6,9 +6,9 @@ var swearjar = { scan: function (text, callback) { var word, key, match; - var regex = /\w+/g, nonRegex = /\W+/g; + var regex = /\S+/g; - while (match = (regex.exec(text) || nonRegex.exec(text))) { + while (match = regex.exec(text)) { word = match[0]; key = word.toLowerCase();