Last active
June 7, 2017 01:07
-
-
Save choonkending/07122834e39ac2f9e49c5b1f0d997500 to your computer and use it in GitHub Desktop.
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
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