Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function removeItem(key, options = {}) {
if (!key) return false
const storageType = getStorageType(options)
if (useLocal(storageType)) {
/* 1. Try localStorage */
localStorage.removeItem(key)
return LOCAL_STORAGE
} else if (useCookie(storageType)) {
/* 2. Fallback to cookie */
removeCookie(key)
return COOKIE
}
/* 3. Fallback to window/global */
globalContext[key] = null
return GLOBAL
}