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

Commit

Permalink
chore(sms): Store allowed phone numbers in a Set
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Tomlinson committed Nov 15, 2017
1 parent 7822603 commit 17a9459
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/settings/allowed_phone_numbers.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@ module.exports = (config, Settings, log) => {
}

isAllowed(phoneNumber) {
return phoneNumber in this.phoneNumbers
return this.phoneNumbers.has(phoneNumber)
}

setAll(phoneNumbers) {
this.phoneNumbers = {}
phoneNumbers.forEach((phoneNumber) => {
this.phoneNumbers[phoneNumber] = true
})
return Object.keys(this.phoneNumbers)
this.phoneNumbers = new Set(phoneNumbers)
}

validate(phoneNumbers) {
Expand All @@ -33,7 +29,7 @@ module.exports = (config, Settings, log) => {
}

toJSON() {
return Object.keys(this.phoneNumbers)
return Array.from(this.phoneNumbers)
}
}

Expand Down

0 comments on commit 17a9459

Please sign in to comment.