gsklee / ngStorage

localStorage and sessionStorage done right for AngularJS.
MIT License
2.34k stars 461 forks source link

try-catch in serialize / deserialize functions for non-JSON local storage values #244

Closed jvanhees closed 4 years ago

jvanhees commented 7 years ago

Fixes issue #204. When a non-valid JSON value was in the local storage (set by an external application for example - like 'abc' instead of '"abc"'), an error would be thrown. Now, it will just set the value without parsing it from JSON.

It is possible to include this fix into the existing release by using the setSerializer / setDeserializer (which I've done in my application).

We might want to include a test for this specific use case?

alekaizer commented 7 years ago

worked like a charm thanks @jvanhees

alekaizer commented 7 years ago

@gsklee when will this PR be implemented? cause it making us have to do this every time we install the module and it's kind of boring when we know there's already a PR that's pending

You'll save a lot of people's day by checking this out

Regards

st-sloth commented 6 years ago

@jvanhees Thank you, saved some time!

@gsklee Is there any chance of this PR getting merged? Pretty important change.