Skip to content

Instantly share code, notes, and snippets.

@ruyaoyao
Forked from gucheen/parseLodash.js
Created April 28, 2017 03:22
Show Gist options
  • Save ruyaoyao/b687037503889df30fb3244edb91890d to your computer and use it in GitHub Desktop.
Save ruyaoyao/b687037503889df30fb3244edb91890d to your computer and use it in GitHub Desktop.
Safe JSON.parse with lodash.js
function parseLodash(str){
return _.attempt(JSON.parse.bind(null, str));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment