Last active
December 12, 2015 06:19
-
-
Save guipn/4728507 to your computer and use it in GitHub Desktop.
This won't throw a TypeError.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// re-written to eliminate need for premises regarding existence of `contacts[i]`. | |
if ( typeof contacts === 'object' && | |
typeof contacts[i] === 'object' && | |
typeof contacts[i].name === 'object' && | |
typeof contacts[i].name.formatted !== 'undefined' && | |
typeof contacts[i].phoneNumbers !== 'undefined' ) { | |
... | |
} | |
else { | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment