Skip to content

Instantly share code, notes, and snippets.

@choonkending
Last active June 7, 2017 01:07
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 choonkending/07122834e39ac2f9e49c5b1f0d997500 to your computer and use it in GitHub Desktop.
Save choonkending/07122834e39ac2f9e49c5b1f0d997500 to your computer and use it in GitHub Desktop.
const getUserFromLocalStorage = keyName => {
const str = localStorage.getItem(keyName);
try {
return Right(Option(JSON.parse(str)));
} catch (e) {
return Left("Invalid or Corrupted User Data");
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment