{"_id":"@bjnstnkvc/cookie","_rev":"9-e6e3df81dfdf1a707476ea22fa899949","name":"@bjnstnkvc/cookie","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.1":{"name":"@bjnstnkvc/cookie","version":"1.0.1","keywords":["storage"],"author":{"name":"Bojan Stankovic"},"license":"MIT","_id":"@bjnstnkvc/cookie@1.0.1","maintainers":[{"name":"bjnstnkvc","email":"dev.bojan.stankovic@gmail.com"}],"homepage":"https://github.com/BJNSTNKVC/js-cookie#readme","bugs":{"url":"https://github.com/BJNSTNKVC/js-cookie/issues"},"dist":{"shasum":"331540056209a2904aafb5d9863d4774268830ed","tarball":"https://registry.npmjs.org/@bjnstnkvc/cookie/-/cookie-1.0.1.tgz","fileCount":15,"integrity":"sha512-gshBwcSebX61oRgOVg9FG0opLaIzgWtEn8qI35Fkf4kpLAYnGqknx9K73Y5M/9KLJGRuREIY/dC9sNWSit0pqQ==","signatures":[{"sig":"MEQCIGD7TWkDsXbsj9bu5JjmYLbly9lb/aieaN2pv1wP9sYrAiAh1bm3UOkyyE+2cYrW3rM5JVMShV0cFJnn6pf5EW1hrg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":117801},"main":"lib/main.js","type":"module","types":"src/main.ts","source":"src/main.ts","exports":{".":{"import":"./lib/main.esm.js","default":"./lib/main.umd.js","require":"./lib/main.umd.js"}},"gitHead":"21820f24d63ebdf8e4854dca126bfe74f267217a","scripts":{"test":"jest --config jestconfig.json ./tests","build":"rollup -c"},"_npmUser":{"name":"bjnstnkvc","email":"dev.bojan.stankovic@gmail.com"},"repository":{"url":"git+https://github.com/BJNSTNKVC/js-cookie.git","type":"git"},"_npmVersion":"11.5.2","description":"Simple wrapper for JavaScript Cookie.","directories":{"lib":"lib"},"_nodeVersion":"20.17.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","rollup":"^4.44.1","terser":"^5.43.1","ts-jest":"^29.4.0","typescript":"^5.8.3","@types/jest":"^29.5.14","@types/node":"^20.19.6","@rollup/plugin-terser":"^0.4.4","jest-environment-jsdom":"^29.7.0","@rollup/plugin-commonjs":"^28.0.6","rollup-plugin-typescript2":"^0.36.0","@rollup/plugin-node-resolve":"^16.0.1"},"_npmOperationalInternal":{"tmp":"tmp/cookie_1.0.1_1756068475516_0.6322875429031911","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@bjnstnkvc/cookie","version":"1.0.2","keywords":["storage"],"author":{"name":"Bojan Stankovic"},"license":"MIT","_id":"@bjnstnkvc/cookie@1.0.2","maintainers":[{"name":"bjnstnkvc","email":"dev.bojan.stankovic@gmail.com"}],"homepage":"https://github.com/BJNSTNKVC/js-cookie#readme","bugs":{"url":"https://github.com/BJNSTNKVC/js-cookie/issues"},"dist":{"shasum":"ae2701c7771f9ff5f2b2c4920a7ebc5d8e1ea79a","tarball":"https://registry.npmjs.org/@bjnstnkvc/cookie/-/cookie-1.0.2.tgz","fileCount":15,"integrity":"sha512-eD3FPOiId1MB+dO3SEH6NykMH1mOWJhhA+pW+HHF0N/ixSdxRgfTql/ayMbrNm1CnPqwC2iIgmk8biLmOLYAnw==","signatures":[{"sig":"MEUCIQDIu5MwyioPwOyHPmxpns1D2bqQxAJ4lw5UvfkNcZPgMgIgBEmNKoBPZbwWdecre2iJC030PLXyX5YnzcxmxSyil3w=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":117800},"main":"lib/main.js","type":"module","types":"src/main.ts","source":"src/main.ts","exports":{".":{"import":"./lib/main.esm.js","default":"./lib/main.umd.js","require":"./lib/main.umd.js"}},"gitHead":"70f8f33b47716082e5f293cd8faa5066eb14717a","scripts":{"test":"jest --config jestconfig.json ./tests","build":"rollup -c"},"_npmUser":{"name":"bjnstnkvc","email":"dev.bojan.stankovic@gmail.com"},"repository":{"url":"git+https://github.com/BJNSTNKVC/js-cookie.git","type":"git"},"_npmVersion":"11.5.2","description":"Simple wrapper for JavaScript Cookie.","directories":{"lib":"lib"},"_nodeVersion":"20.17.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","rollup":"^4.44.1","terser":"^5.43.1","ts-jest":"^29.4.0","typescript":"^5.8.3","@types/jest":"^29.5.14","@types/node":"^20.19.6","@rollup/plugin-terser":"^0.4.4","jest-environment-jsdom":"^29.7.0","@rollup/plugin-commonjs":"^28.0.6","rollup-plugin-typescript2":"^0.36.0","@rollup/plugin-node-resolve":"^16.0.1"},"_npmOperationalInternal":{"tmp":"tmp/cookie_1.0.2_1756135020236_0.5243837763019212","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@bjnstnkvc/cookie","version":"1.0.3","keywords":["storage"],"author":{"name":"Bojan Stankovic"},"license":"MIT","_id":"@bjnstnkvc/cookie@1.0.3","maintainers":[{"name":"bjnstnkvc","email":"dev.bojan.stankovic@gmail.com"}],"homepage":"https://github.com/BJNSTNKVC/js-cookie#readme","bugs":{"url":"https://github.com/BJNSTNKVC/js-cookie/issues"},"dist":{"shasum":"e95e8a2d6f693566eef5402d1c5b37bbd29a49dd","tarball":"https://registry.npmjs.org/@bjnstnkvc/cookie/-/cookie-1.0.3.tgz","fileCount":55,"integrity":"sha512-IXmVEkU9in2DX4UfDGjJ1azxd11zD4642k6Xu52asr9AdQBNzb9EZw9HEpratXty9MmJTTnI2OTCeO1fjDWiLw==","signatures":[{"sig":"MEUCIQDmAjyKLb8D6dq26DuLbsRz3+4XAVoU6xcNM/hTjZR20QIgYBmkrMBfA7fb6C/W95ERjYZ1LOBvu+0S5GP9lAy4ekk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":331053},"main":"lib/main.js","type":"module","types":"src/main.ts","source":"src/main.ts","exports":{".":{"import":"./lib/main.esm.js","default":"./lib/main.umd.js","require":"./lib/main.umd.js"}},"gitHead":"2ed914913ed84602c8a211b30dad4c60eaa5b0af","scripts":{"test":"jest --config jestconfig.json ./tests","build":"rollup -c"},"_npmUser":{"name":"bjnstnkvc","email":"dev.bojan.stankovic@gmail.com"},"repository":{"url":"git+https://github.com/BJNSTNKVC/js-cookie.git","type":"git"},"_npmVersion":"11.7.0","description":"Simple wrapper for JavaScript Cookie.","directories":{"lib":"lib"},"_nodeVersion":"20.17.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","rollup":"^4.44.1","terser":"^5.43.1","ts-jest":"^29.4.0","typescript":"^5.8.3","@types/jest":"^29.5.14","@types/node":"^20.19.6","@rollup/plugin-terser":"^1.0.0","jest-environment-jsdom":"^30.3.0","@rollup/plugin-commonjs":"^28.0.6","rollup-plugin-typescript2":"^0.36.0","@rollup/plugin-node-resolve":"^16.0.1"},"_npmOperationalInternal":{"tmp":"tmp/cookie_1.0.3_1774878374655_0.5302980295746789","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@bjnstnkvc/cookie","version":"1.0.4","keywords":["storage"],"author":{"name":"Bojan Stankovic"},"license":"MIT","_id":"@bjnstnkvc/cookie@1.0.4","maintainers":[{"name":"bjnstnkvc","email":"dev.bojan.stankovic@gmail.com"}],"homepage":"https://github.com/BJNSTNKVC/js-cookie#readme","bugs":{"url":"https://github.com/BJNSTNKVC/js-cookie/issues"},"dist":{"shasum":"ad18cbc5ec5b3facc2b1bda9c65419ea0816860d","tarball":"https://registry.npmjs.org/@bjnstnkvc/cookie/-/cookie-1.0.4.tgz","fileCount":56,"integrity":"sha512-40648w6Yg00Wp0aMdmNMSeQ/qeZjX04zS3ZsD3xzEzzqOVhISMJDA1j3jiZfmwDlHnBIFs3CRwKb8mDbLroJ4g==","signatures":[{"sig":"MEUCIHRyq3I+HHW2p/ceGQZ7hy5dmDoKJo7CBBcgU7fjfDRVAiEA1cAs0knPYJ4PEovAL+8TVn0WA0mV8/4LA/CE7l8I/oc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIGrGcAk9UN4pyQYVZubCdT+ghLw5iJZ4xTsCnH5dDJwJAiEAgnfb5EYfl9bKhnxhjqIYLTVvM5pVwsQZrm2fVj816MA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":331986},"main":"lib/main.js","type":"module","types":"src/main.ts","source":"src/main.ts","exports":{".":{"types":"./src/main.ts","import":"./lib/main.esm.js","default":"./lib/main.umd.js","require":"./lib/main.umd.js"}},"gitHead":"ab97d36c8409ed39f76af57ffc86444456a05e85","scripts":{"test":"jest --config jestconfig.json ./tests","build":"rollup -c","coverage":"jest --config jestconfig.json ./tests --coverage","typecheck":"tsc --noEmit"},"_npmUser":{"name":"bjnstnkvc","email":"dev.bojan.stankovic@gmail.com"},"repository":{"url":"git+https://github.com/BJNSTNKVC/js-cookie.git","type":"git"},"_npmVersion":"11.7.0","description":"Simple wrapper for JavaScript Cookie.","directories":{"lib":"lib"},"_nodeVersion":"24.16.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","rollup":"^4.44.1","terser":"^5.43.1","ts-jest":"^29.4.0","typescript":"^5.8.3","@types/jest":"^29.5.14","@types/node":"^20.19.6","@rollup/plugin-terser":"^1.0.0","jest-environment-jsdom":"^30.3.0","@rollup/plugin-commonjs":"^28.0.6","rollup-plugin-typescript2":"^0.36.0","@rollup/plugin-node-resolve":"^16.0.1"},"_npmOperationalInternal":{"tmp":"tmp/cookie_1.0.4_1789679246780_0.9858444710527046","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@bjnstnkvc/cookie","version":"1.0.5","keywords":["storage"],"author":{"name":"Bojan Stankovic"},"license":"MIT","_id":"@bjnstnkvc/cookie@1.0.5","maintainers":[{"name":"bjnstnkvc","email":"dev.bojan.stankovic@gmail.com"}],"homepage":"https://github.com/BJNSTNKVC/js-cookie#readme","bugs":{"url":"https://github.com/BJNSTNKVC/js-cookie/issues"},"dist":{"shasum":"28b621462468350ce781cbf15fe9b795de2a3a8b","tarball":"https://registry.npmjs.org/@bjnstnkvc/cookie/-/cookie-1.0.5.tgz","fileCount":56,"integrity":"sha512-30y+X+8nArRalXgVqalsrxQ3iSJNeYaPzQtHfO2q5USInm7JPXt2qTG6CZ+duu9Id5sMijLzu03rVk6j7FnoNQ==","signatures":[{"sig":"MEQCIC3XEmY9Wb4xp8cJZ6+a6ntidYdRrr1b7wVa1+wKSplNAiBiROBHRETfjvkG/Fa+0qqfEyX4QATTNjSqIAzfgk/jdg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIEv0U+uVaC21xxzRtcNQuhyikaFUFwM774ntiTgyZmbjAiEA/PbjGzw8MX0Hh20eqnR52vOAUbLZa+5Bo08PlSfjp3c=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":333375},"main":"lib/main.js","type":"module","types":"src/main.ts","source":"src/main.ts","exports":{".":{"types":"./src/main.ts","import":"./lib/main.esm.js","default":"./lib/main.umd.js","require":"./lib/main.umd.js"}},"gitHead":"971c6604851bb617b8da3916b1fdb4458c4295f7","scripts":{"test":"jest --config jestconfig.json ./tests","build":"rollup -c","coverage":"jest --config jestconfig.json ./tests --coverage","typecheck":"tsc --noEmit"},"_npmUser":{"name":"bjnstnkvc","email":"dev.bojan.stankovic@gmail.com"},"repository":{"url":"git+https://github.com/BJNSTNKVC/js-cookie.git","type":"git"},"_npmVersion":"11.7.0","description":"Simple wrapper for JavaScript Cookie.","directories":{"lib":"lib"},"_nodeVersion":"24.16.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","rollup":"^4.44.1","terser":"^5.43.1","ts-jest":"^29.4.0","typescript":"^5.8.3","@types/jest":"^29.5.14","@types/node":"^20.19.6","@rollup/plugin-terser":"^1.0.0","jest-environment-jsdom":"^30.3.0","@rollup/plugin-commonjs":"^28.0.6","rollup-plugin-typescript2":"^0.36.0","@rollup/plugin-node-resolve":"^16.0.1"},"_npmOperationalInternal":{"tmp":"tmp/cookie_1.0.5_1789720908758_0.2601387845014975","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"_id":"@bjnstnkvc/cookie@1.1.0","bugs":{"url":"https://github.com/BJNSTNKVC/js-cookie/issues"},"dist":{"shasum":"c99be7aeb58ed7946f9bc2415f54354b9f9185b9","tarball":"https://registry.npmjs.org/@bjnstnkvc/cookie/-/cookie-1.1.0.tgz","fileCount":56,"integrity":"sha512-v7xPCBK76oHtw39PBsFSaM/rzry80kOtWkD+O0MLnP41FT4fmJGzTw0wX2NpRBIUXJnN+RPTmEo73XvjA/zQzA==","signatures":[{"sig":"MEUCIBRTVBDzXYyLwUm28SB4snTIQnN+DmFuGccfwK+OZyHZAiEA5+czYY5Ent+LMiPZZM0ECXpPQWz8KpRxjequCdmpb9I=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCs2DgLTw1+VJp3hJvzKgHIKVGIeTD7Tewzj2lAhYCPqQIhAJaNres0JPZfWziRN64X+wlXCNH/iJiVp798vcFnsGy7"}],"unpackedSize":336729},"main":"lib/main.js","name":"@bjnstnkvc/cookie","type":"module","types":"src/main.ts","author":{"name":"Bojan Stankovic"},"source":"src/main.ts","exports":{".":{"types":"./src/main.ts","import":"./lib/main.esm.js","default":"./lib/main.umd.js","require":"./lib/main.umd.js"}},"gitHead":"484589f85d039efa2dd15542e8b4e63d53c9aa98","license":"MIT","scripts":{"test":"jest --config jestconfig.json ./tests","build":"rollup -c","coverage":"jest --config jestconfig.json ./tests --coverage","typecheck":"tsc --noEmit"},"version":"1.1.0","_npmUser":{"name":"bjnstnkvc","email":"dev.bojan.stankovic@gmail.com"},"homepage":"https://github.com/BJNSTNKVC/js-cookie#readme","keywords":["storage"],"repository":{"url":"git+https://github.com/BJNSTNKVC/js-cookie.git","type":"git"},"_npmVersion":"11.7.0","description":"Simple wrapper for JavaScript Cookie.","directories":{"lib":"lib"},"maintainers":[{"name":"bjnstnkvc","email":"dev.bojan.stankovic@gmail.com"}],"_nodeVersion":"24.16.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","rollup":"^4.44.1","terser":"^5.43.1","ts-jest":"^29.4.0","typescript":"^5.8.3","@types/jest":"^29.5.14","@types/node":"^20.19.6","@rollup/plugin-terser":"^1.0.0","jest-environment-jsdom":"^30.3.0","@rollup/plugin-commonjs":"^28.0.6","rollup-plugin-typescript2":"^0.36.0","@rollup/plugin-node-resolve":"^16.0.1"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cookie_1.1.0_1789736557105_0.2753095380344368"}}},"time":{"created":"2025-08-24T20:47:55.462Z","modified":"2026-09-18T13:02:37.340Z","1.0.0":"2025-08-24T20:40:22.778Z","1.0.1":"2025-08-24T20:47:55.758Z","1.0.2":"2025-08-25T15:17:00.417Z","1.0.3":"2026-03-30T13:46:14.817Z","1.0.4":"2026-09-17T21:07:26.878Z","1.0.5":"2026-09-18T08:41:48.848Z","1.1.0":"2026-09-18T13:02:37.204Z"},"bugs":{"url":"https://github.com/BJNSTNKVC/js-cookie/issues"},"author":{"name":"Bojan Stankovic"},"license":"MIT","homepage":"https://github.com/BJNSTNKVC/js-cookie#readme","keywords":["storage"],"repository":{"url":"git+https://github.com/BJNSTNKVC/js-cookie.git","type":"git"},"description":"Simple wrapper for JavaScript Cookie.","maintainers":[{"name":"bjnstnkvc","email":"dev.bojan.stankovic@gmail.com"}],"readme":"# Cookie\r\n\r\nA class that provides a set of methods for interacting with the browser's local storage.\r\n\r\n## Installation & setup\r\n\r\n### NPM\r\n\r\nYou can install the package via npm:\r\n\r\n```bash\r\nnpm install @bjnstnkvc/cookie\r\n```\r\n\r\nand then import it into your project\r\n\r\n```javascript\r\nimport { Cookie } from '@bjnstnkvc/cookie';\r\n```\r\n\r\n### CDN\r\n\r\nYou can install the package via jsDelivr CDN:\r\n\r\n```html\r\n<script src=\"https://cdn.jsdelivr.net/npm/@bjnstnkvc/cookie/lib/main.min.js\"></script>\r\n```\r\n\r\n## Usage\r\n\r\n### set\r\n\r\nSet the value for a given key in the Cookie object.\r\n\r\n#### Parameters\r\n\r\n- **key** - String containing the name of the key.\r\n- **value** - The value to be stored.\r\n- **[attributes](#cookie-attributes)** *(optional)* - Cookie configuration options.\r\n\r\n#### Example\r\n\r\n```javascript\r\nCookie.set('key', 'value'); \r\n```\r\n\r\n### get\r\n\r\nRetrieve the value associated with the given key from the Cookie object.\r\n\r\n#### Parameters\r\n\r\n- **key** - String containing the name of the key.\r\n- **fallback** *(optional)* - The fallback value in case the key does not exist. Defaults to `null`.\r\n\r\n#### Example\r\n\r\n```javascript\r\nCookie.get('key', 'default');\r\n```\r\n\r\nYou can also pass a closure as the default value. If the specified item is not found in the Cookie object, the closure will be executed and its result returned. \r\nThis allows you to lazily load default values from other sources:\r\n\r\n```javascript\r\nCookie.get('key', () => 'default');\r\n```\r\n\r\nThe closure may also be asynchronous. In that case, if the key is not found, the Promise returned by the closure is returned, so the result should be awaited:\r\n\r\n```javascript\r\nconst value = await Cookie.get('key', async () => await fetchDefault());\r\n```\r\n\r\n### remember\r\n\r\nRetrieve the value associated with the given key, or execute the given callback and store the result in the Cookie object.\r\n\r\n#### Parameters\r\n\r\n- **key** - String containing the name of the key.\r\n- **callback** - Function you want to execute.\r\n- **[attributes](#cookie-attributes)** *(optional)* - Cookie configuration options.\r\n\r\n#### Example\r\n\r\n```javascript\r\nCookie.remember('key', () => 'default');\r\n```\r\n\r\nThe callback may also be asynchronous. In that case, if the key is not found, the value is stored once the callback resolves and a Promise resolving with the written cookie string is returned. If the key exists, its value is returned right away without executing the callback, so awaiting the result covers both cases:\r\n\r\n```javascript\r\nawait Cookie.remember('key', async () => await fetchDefault());\r\n```\r\n\r\n### all\r\n\r\nRetrieve an array containing all keys and their associated values stored in the Cookie object.\r\n\r\n#### Example\r\n\r\n```javascript\r\nCookie.all();\r\n```\r\n\r\n> **Note:** The `all` method returns an array of objects with `key` and `value` properties (e.g. `[{ key: 'key', value: 'value' }]`)\r\n\r\n### remove\r\n\r\nRemove the key and its associated value from the Cookie object.\r\n\r\n#### Parameters\r\n\r\n- **key** - String containing the name of the key to be deleted.\r\n- **[attributes](#cookie-attributes)** *(optional)* - Cookie attributes (only `path` is allowed).\r\n\r\n#### Example\r\n\r\n```javascript\r\nCookie.remove('key');\r\n```\r\n\r\nOptionally, you can pass attributes to the `remove` method to remove cookies from a specific path:\r\n\r\n```javascript\r\nCookie.remove('key', { path: '/' });\r\n```\r\n\r\n### clear\r\n\r\nClear all keys and their associated values from the Cookie object.\r\n\r\n#### Parameters\r\n\r\n- **[attributes](#cookie-attributes)** *(optional)* - Cookie attributes (only `path` is allowed).\r\n\r\n#### Example\r\n\r\n```javascript\r\nCookie.clear();\r\n```\r\n\r\nOptionally, you can pass attributes to the `clear` method to remove cookies from a specific path:\r\n\r\n```javascript\r\nCookie.clear({ path: '/' });\r\n```\r\n\r\n### has\r\n\r\nCheck if a key exists in the Cookie object.\r\n\r\n#### Parameters\r\n\r\n- **key** - String containing the name of the key to be checked.\r\n\r\n#### Example\r\n\r\n```javascript\r\nCookie.has('key');\r\n```\r\n\r\n### hasAny\r\n\r\nCheck if any of the provided keys exist in the Cookie object.\r\n\r\n#### Parameters\r\n\r\n- **keys** - String or an array of strings containing the names of the keys to be checked.\r\n\r\n#### Example\r\n\r\n```javascript\r\nCookie.hasAny(['key1', 'key2']);\r\n```\r\n\r\n### isEmpty\r\n\r\nCheck if the Cookie object is empty.\r\n\r\n#### Example\r\n\r\n```javascript\r\nCookie.isEmpty();\r\n```\r\n\r\n### isNotEmpty\r\n\r\nCheck if the Cookie object is not empty.\r\n\r\n#### Example\r\n\r\n```javascript\r\nCookie.isNotEmpty();\r\n```\r\n\r\n### keys\r\n\r\nRetrieve an array containing all keys stored in the Cookie object.\r\n\r\n#### Example\r\n\r\n```javascript\r\nCookie.keys();\r\n```\r\n\r\n### count\r\n\r\nRetrieve the total number of items stored in the Cookie object.\r\n\r\n#### Example\r\n\r\n```javascript\r\nCookie.count();\r\n```\r\n\r\n### touch\r\n\r\nUpdate the expiration time of a key in the Cookie object.\r\n\r\n#### Parameters\r\n\r\n- **key** - String containing the name of the key.\r\n- **ttl** *(optional)* - Time to live in seconds for the key. Defaults to `null` (no expiration) or equal to [Cookie.ttl](#ttl) value.\r\n- **[attributes](#cookie-attributes)** *(optional)* - Cookie attributes (only `path` is allowed).\r\n\r\n#### Example\r\n\r\n```javascript\r\nCookie.touch('key', 60);\r\n```\r\n\r\nOptionally, you can pass attributes to the `touch` method to update cookies from a specific path:\r\n\r\n```javascript\r\nCookie.touch('key', 60, { path: '/' });\r\n```\r\n\r\n### dump\r\n\r\nPrint the value associated with a key to the console.\r\n\r\n#### Parameters\r\n\r\n- **key** - String containing the name of the key.\r\n\r\n#### Example\r\n\r\n```javascript\r\nCookie.dump('key');\r\n```\r\n\r\n\r\n### fake\r\n\r\nReplace the Cookie instance with a fake implementation. This is particularly useful for testing purposes where you want to avoid interacting with the actual browser's Cookie.\r\n\r\n#### Example\r\n\r\n```javascript\r\nCookie.fake();\r\n```\r\n\r\n### restore\r\n\r\nRestore the original Cookie instance. This is typically used after [fake()](#fake) to return to using the real browser's Cookie.\r\n\r\n#### Example\r\n\r\n```javascript\r\nCookie.restore();\r\n```\r\n\r\n### isFake\r\n\r\nCheck if a fake Cookie instance is currently being used.\r\n\r\n#### Example\r\n\r\n```javascript\r\nif (Cookie.isFake()) {\r\n    // ...\r\n}\r\n```\r\n\r\n### setFakeLocation\r\n\r\nSets the `location` object to a fake implementation. This is particularly useful for testing purposes where you want to avoid interacting with the actual browser's location.\r\n\r\n#### Parameters\r\n\r\n- **location** - An object containing `host` and `pathname` properties. It is used to simulate the location of the current page when using the fake Cookie instance.\r\n\r\n#### Example\r\n\r\n```javascript\r\nCookie.setFakeLocation({\r\n    host    : 'example.com',\r\n    pathname: '/test'\r\n});\r\n```\r\n\r\nIn case the Cookie is not faked, `setFakeLocation` will throw an error.\r\n\r\n#### Example\r\n\r\n```javascript\r\nif (Cookie.isFake()) {\r\n    // ...\r\n}\r\n```\r\n\r\n\r\n### ttl\r\n\r\nDefine a global Time-To-Live (TTL) in seconds for all items saved using the [Cookie.set](#set) or [Cookie.touch](#touch) method, without specifying a TTL for each item. This can be particularly useful for applications needing a consistent expiry policy for most stored data.\r\n\r\n#### Example\r\n\r\n```javascript\r\nCookie.ttl(7200);\r\n```\r\n\r\nIf a default TTL has been set using `Cookie.ttl`, it will be applied to all items set without a specified TTL.\r\n\r\n### Cookie Attributes\r\n\r\nWhen setting cookies, you can provide the following attributes:\r\n\r\n- `ttl` - Time to live in seconds (overrides expires if both are provided)\r\n- `expires` - Date object or date string for cookie expiration\r\n- `path` - Path for the cookie (defaults to current path)\r\n- `domain` - Domain for the cookie (defaults to current domain)\r\n- `sameSite` - SameSite attribute (`Strict`, `Lax`, or `None`)\r\n- `secure` - Whether the cookie should only be sent over secure protocols\r\n\r\n>**Note:** If `sameSite` is set to `None`, the `secure` attribute must be set to `true`.\r\n\r\n## Events\r\n\r\nIn case you would like to execute a callback on Cookie Storage operation, you may listen for various events dispatched by\r\nthe Cookie Storage.\r\n\r\n| Type            | Event           |\r\n|-----------------|-----------------|\r\n| `retrieving`    | RetrievingKey   |\r\n| `hit`           | KeyHit          |\r\n| `missed`        | KeyMissed       |\r\n| `writing`       | WritingKey      |\r\n| `written`       | KeyWritten      |\r\n| `write-failed`  | KeyWriteFailed  |\r\n| `forgot`        | KeyForgotten    |\r\n| `forgot-failed` | KeyForgotFailed |\r\n| `flushing`      | StorageFlushing |\r\n| `flushed`       | StorageFlushed  |\r\n\r\n### listen\r\n\r\nRegister an event listener for one or more storage events.\r\n\r\n#### Parameters\r\n\r\n- **events** - String or an object of strings containing the type and a callback function.\r\n- **callback** - Function to be executed when the event is dispatched in case an event is passed as a string.\r\n\r\n#### Example\r\n\r\n```javascript\r\nCookie.listen('retrieving', (event) => {\r\n    console.log(event);\r\n});\r\n```\r\n\r\nIn case you would like to register multiple events, you can pass an object containing the type and a callback function:\r\n\r\n```javascript\r\nCookie.listen({\r\n    'retrieving': (event) => {\r\n        // ...\r\n    },\r\n    'hit': (event) => {\r\n        // ...\r\n    },\r\n    'missed': (event) => {\r\n        // ...\r\n    },\r\n    'writing': (event) => {\r\n        // ...\r\n    },\r\n    'written': (event) => {\r\n        // ...\r\n    },\r\n    'write-failed': (event) => {\r\n        // ...\r\n    },\r\n    'forgot': (event) => {\r\n        // ...\r\n    },\r\n    'forgot-failed': (event) => {\r\n        // ...\r\n    },\r\n    'flushing': (event) => {\r\n        // ...\r\n    },\r\n    'flushed': (event) => {\r\n        // ...\r\n    },\r\n});\r\n```\r\n\r\nConveniently, you can also use the following methods to register event listeners for a specific event:\r\n\r\n### onRetrieving\r\n\r\nTriggered when a key is about to be retrieved from storage.\r\n\r\n```javascript\r\nCookie.onRetrieving((event) => {\r\n  // ...\r\n});\r\n```\r\n\r\n### onHit\r\n\r\nTriggered when a requested key is found in the storage.\r\n\r\n```javascript\r\nCookie.onHit((event) => {\r\n  // ...\r\n});\r\n```\r\n\r\n### onMissed\r\n\r\nTriggered when a requested key is not found in the storage.\r\n\r\n```javascript\r\nCookie.onMissed((event) => {\r\n  // ...\r\n});\r\n```\r\n\r\n### onWriting\r\n\r\nTriggered when a key is about to be written to storage.\r\n\r\n```javascript\r\nCookie.onWriting((event) => {\r\n  // ...\r\n});\r\n```\r\n\r\n### onWritten\r\n\r\nTriggered after a key has been successfully written to storage.\r\n\r\n```javascript\r\nCookie.onWritten((event) => {\r\n  // ...\r\n});\r\n```\r\n\r\n### onWriteFailed\r\n\r\nTriggered when writing a key to storage fails.\r\n\r\n```javascript\r\nCookie.onWriteFailed((event) => {\r\n  // ...\r\n});\r\n```\r\n\r\n### onForgot\r\n\r\nTriggered when a key is successfully removed from storage.\r\n\r\n```javascript\r\nCookie.onForgot((event) => {\r\n  // ...\r\n});\r\n```\r\n\r\n### onForgotFailed\r\n\r\nTriggered when removing a key from storage fails.\r\n\r\n```javascript\r\nCookie.onForgotFailed((event) => {\r\n  // ...\r\n});\r\n```\r\n\r\n### onFlushing\r\n\r\nTriggered when the storage is about to be cleared.\r\n\r\n```javascript\r\nCookie.onFlushing((event) => {\r\n  // ...\r\n});\r\n```\r\n\r\n### onFlushed\r\n\r\nTriggered after the storage has been successfully cleared.\r\n\r\n```javascript\r\nCookie.onFlushed((event) => {\r\n    // ...\r\n});\r\n```\r\n","readmeFilename":"README.md"}