Skip to content

Instantly share code, notes, and snippets.

@tfogo
Last active January 23, 2017 20:50
Show Gist options
  • Select an option

  • Save tfogo/2f680f71a2b2600f469a91eba719ae52 to your computer and use it in GitHub Desktop.

Select an option

Save tfogo/2f680f71a2b2600f469a91eba719ae52 to your computer and use it in GitHub Desktop.
Test for primality for phone numbers from all the promises
phonePromise.then(data => {
let verifiedPrimes = [];
data.forEach(twilioObject => {
twilioObject.available_phone_numbers.forEach(e => {
if (primality(e.phone_number.slice(2)) && !verifiedPrimes.includes(e.phone_number.slice(2))) {
verifiedPrimes.push(e.phone_number.slice(2));
}
});
});
console.log(verifiedPrimes);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment