Created by: kpgarrod
If you accidentally store a null or undefined value, localStorage will save it OK, but JSON.parse will blow up when you try to get it back, because 'undefined' is not a valid JSON token. This fix prevents undefined values from being stored and values being stored in undefined places.