// Check for localStorage support
var hasLocalStorage = typeof window !== 'undefined' && window.localStorage;

var _localStorage = {
    getItem: function(key) {
        if (!hasLocalStorage) { return null; }

        return window.localStorage.getItem(key);
    },
    setItem: function(key, value) {
        if (!hasLocalStorage) { return null; }

        return window.localStorage.setItem(key, value);
    }
};

module.exports = _localStorage;
var hasLocalStorage = function() {
	try {
		return typeof window !== 'undefined' && window.localStorage;
	} catch(e) {
		return false;
	}
}

var _localStorage = {
    getItem: function(key) {
        if (!hasLocalStorage()) {
        try {
            return window.localStorage.getItem(key);
        } catch(e) {
		    return null;
	    }
    },
    setItem: function(key, value) {
        if (!hasLocalStorage()) { return null; }
        try {
            return window.localStorage.setItem(key, value);
        } catch(e) {
		    return null;
	    }
    }
};

Fix error in checking for localStorage