From 81cbb5af2b0e72a02a8cf1a55b26977c46e9a10d Mon Sep 17 00:00:00 2001 From: Wes Johnson Date: Tue, 27 Apr 2021 14:27:36 -0400 Subject: [PATCH] fix(es5): make es-check pass (#33) --- social-insurance-number.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/social-insurance-number.js b/social-insurance-number.js index bdc3da6..fc55a7a 100644 --- a/social-insurance-number.js +++ b/social-insurance-number.js @@ -88,15 +88,17 @@ if (doesNotStartWith) { // convert a single entry to a list doesNotStartWith = [].concat(doesNotStartWith); - var possibleSinPrefixes = [...new Set([].concat.apply([], Object.values(PROVINCES)))]; + var possibleSinPrefixes = Array.from(new Set([].concat.apply([], Object.values(PROVINCES)))); if (province) { possibleSinPrefixes = PROVINCES[province]; } - var validStartsWithChoices = possibleSinPrefixes.filter( - (prefix) => !doesNotStartWith.includes(String(prefix)) - ); + var filter = function(prefix) { + return !doesNotStartWith.includes(String(prefix)) + } + + var validStartsWithChoices = possibleSinPrefixes.filter(filter); if (!validStartsWithChoices.length) { throw "Cannot find a valid number to start with.";