Skip to content

Instantly share code, notes, and snippets.

@sethdavis512
Created November 24, 2017 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sethdavis512/7a8d54605815e2df085f44550a73810d to your computer and use it in GitHub Desktop.
Save sethdavis512/7a8d54605815e2df085f44550a73810d to your computer and use it in GitHub Desktop.
function getSafe(fn) {
try {
return fn();
} catch (e) {
return undefined;
}
}
getSafe(() => obj.a.lot.of.properties);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment