Skip to content

Instantly share code, notes, and snippets.

@cointilt
Forked from nathansmith/gist:4354237
Created December 21, 2012 17:29
Show Gist options
  • Save cointilt/4354271 to your computer and use it in GitHub Desktop.
Save cointilt/4354271 to your computer and use it in GitHub Desktop.
// Check existence
function exists(thing) {
return (typeof thing !== 'undefined' && thing !== null) ? thing : undefined;
}
/*
Usage...
var options = {
latitude: 0,
longitude: 1
};
var lat = exists(options.latitude);
var lon = exists(options.longitude);
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment