Skip to content
This repository has been archived by the owner on Apr 25, 2022. It is now read-only.

Commit

Permalink
fix(es5): make es-check pass (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wes Johnson authored Apr 27, 2021
1 parent ab3e877 commit 81cbb5a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions social-insurance-number.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.";
Expand Down

0 comments on commit 81cbb5a

Please sign in to comment.