{"version":3,"file":"index.cjs","names":[],"sources":["../src/cache.ts","../src/index.ts"],"sourcesContent":["import type { TCache, TCacheOptions } from '@flopflip/types';\n\nconst createCache = (options: TCacheOptions) => {\n  const cache: TCache = {\n    get(key) {\n      const cacheKey = [options.prefix, key].join('/');\n\n      const localStorageValue = localStorage.getItem(cacheKey);\n\n      return localStorageValue ? JSON.parse(localStorageValue) : null;\n    },\n    set(key, value) {\n      try {\n        const cacheKey = [options.prefix, key].join('/');\n\n        localStorage.setItem(cacheKey, JSON.stringify(value));\n\n        return true;\n      } catch (_error) {\n        return false;\n      }\n    },\n    unset(key) {\n      const cacheKey = [options.prefix, key].join('/');\n\n      localStorage.removeItem(cacheKey);\n    },\n  };\n\n  return cache;\n};\n\nexport { createCache };\n","const version = '__@FLOPFLIP/VERSION_OF_RELEASE__';\n\nexport { createCache } from './cache';\nexport { version };\n"],"mappings":";;AAEA,MAAM,eAAe,YAA2B;CA2B9C,OAAO;EAzBL,IAAI,KAAK;GACP,MAAM,WAAW,CAAC,QAAQ,QAAQ,GAAG,CAAC,CAAC,KAAK,GAAG;GAE/C,MAAM,oBAAoB,aAAa,QAAQ,QAAQ;GAEvD,OAAO,oBAAoB,KAAK,MAAM,iBAAiB,IAAI;EAC7D;EACA,IAAI,KAAK,OAAO;GACd,IAAI;IACF,MAAM,WAAW,CAAC,QAAQ,QAAQ,GAAG,CAAC,CAAC,KAAK,GAAG;IAE/C,aAAa,QAAQ,UAAU,KAAK,UAAU,KAAK,CAAC;IAEpD,OAAO;GACT,SAAS,QAAQ;IACf,OAAO;GACT;EACF;EACA,MAAM,KAAK;GACT,MAAM,WAAW,CAAC,QAAQ,QAAQ,GAAG,CAAC,CAAC,KAAK,GAAG;GAE/C,aAAa,WAAW,QAAQ;EAClC;CAGS;AACb;;AC9BA,MAAM,UAAU"}