@modern-kit/utils
Version:
1 lines • 837 B
Source Map (JSON)
{"version":3,"file":"index.mjs","sources":["../../../src/storage/clearStorage/index.ts"],"sourcesContent":["import { isClient } from '../../device';\n\nexport function clearStorage(type: 'localStorage' | 'sessionStorage') {\n if (!isClient()) {\n throw new Error('Cannot be executed unless it is a client environment.');\n }\n\n try {\n const storage = window[type];\n storage.clear();\n } catch (err) {\n throw new Error(`Failed to clear ${type}: ${err}`);\n }\n}\n"],"names":[],"mappings":";;;AAEO,SAAS,aAAa,IAAA,EAAyC;AACpE,EAAA,IAAI,CAAC,UAAS,EAAG;AACf,IAAA,MAAM,IAAI,MAAM,uDAAuD,CAAA;AAAA,EACzE;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,OAAA,GAAU,OAAO,IAAI,CAAA;AAC3B,IAAA,OAAA,CAAQ,KAAA,EAAM;AAAA,EAChB,SAAS,GAAA,EAAK;AACZ,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,gBAAA,EAAmB,IAAI,CAAA,EAAA,EAAK,GAAG,CAAA,CAAE,CAAA;AAAA,EACnD;AACF;;;;"}