angular-local-storage
angular-local-storage copied to clipboard
getFromCookies returns inconsistent value when not supported
This is something I came across when trying to use Local Storage which eventually fallbacks to also unsupported/blocked cookie storage. Repro steps:
- Call LocalStorageService.get('dummyKey')
- Local Storage is not supported, so we fallback to cookie retrieval.
- So this is executed: getFromCookies('dummyKey')
- Cookies are not supported either.
Expected result: return null Actual result: return false
So I guess this is debatable, but I would expect that if cookies are not supported, it would return the same value as if the cookie did not exist, which is null.
As of time of writing, getFromCookies is the method with this logic.