@cygnus-wealth/asset-valuator
Version:
Asset valuation library for retrieving and converting cryptocurrency prices
19 lines (18 loc) • 514 B
JavaScript
export function isBrowser() {
return typeof globalThis !== 'undefined' &&
typeof globalThis.window !== 'undefined' &&
typeof globalThis.window.document !== 'undefined';
}
export function hasIndexedDB() {
return isBrowser() && 'indexedDB' in globalThis.window;
}
export function hasLocalStorage() {
try {
return isBrowser() &&
'localStorage' in globalThis.window &&
globalThis.window.localStorage !== null;
}
catch {
return false;
}
}