Skip to content

Commit

Permalink
if the stored value was an object, then it could end up with a space …
Browse files Browse the repository at this point in the history
…before the {, causing the stored value not to be json parsed simply because of a space in the first character (#6467)
  • Loading branch information
smenzer committed Mar 24, 2021
1 parent f3fe966 commit 9faeb68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/userId/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ function getStoredValue(storage, key = undefined) {
}
}
// support storing a string or a stringified object
if (typeof storedValue === 'string' && storedValue.charAt(0) === '{') {
if (typeof storedValue === 'string' && storedValue.trim().charAt(0) === '{') {
storedValue = JSON.parse(storedValue);
}
} catch (e) {
Expand Down

0 comments on commit 9faeb68

Please sign in to comment.