From 003f7a1b7ab9a89779b9a82d354c7bae00f2f6f4 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Sat, 8 Jun 2019 14:33:10 +0200 Subject: [PATCH] Remove support for decades MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …apostrophes in numbers aren’t always decades, so the previous support caused false-positives. Closes GH-7. --- index.js | 9 +-------- test.js | 7 ++----- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/index.js b/index.js index e9cd688..d4d7649 100644 --- a/index.js +++ b/index.js @@ -15,9 +15,7 @@ var straightId = 'smart-apostrophe' var smartId = 'straight-apostrophe' // Regex to match an elided decade. -var decadeExpression = /^\d\ds$/ var apostropheExpression = /['’]/g -var apostrophe = "'" var rightSingleQuotationMark = '’' var own = {}.hasOwnProperty @@ -40,15 +38,10 @@ function contractions(options) { var expected var message - // Suggest if either the straightened version is listed, or if this is a - // decade (80’s and 80s > ’80s). + // Suggest if the straightened version is listed. if (own.call(data, normal)) { expected = data[normal] - } else if (decadeExpression.test(normal)) { - expected = apostrophe + normal - } - if (expected) { if (!straight) { expected = smarten(expected) } diff --git a/test.js b/test.js index 24d18a8..a597ed9 100644 --- a/test.js +++ b/test.js @@ -149,11 +149,8 @@ test('contractions(value)', function(t) { ['It was acceptable in the 80s, I mean 80’s, no wait?'].join('\n') ) .messages.map(String), - [ - '1:26-1:29: Expected an apostrophe in `80s`, like this: `’80s`', - '1:38-1:42: Expected the apostrophe in `80’s` to be like this: `’80s`' - ], - 'should catch decades' + [], + 'should ignore decades (GH-7)' ) t.deepEqual(