{"name":"universal-cookie","version":"8.1.2","description":"Universal cookies for JavaScript","main":"cjs/index.js","types":"cjs/index.d.ts","module":"esm/index.mjs","exports":{".":{"import":{"types":"./esm/index.d.ts","default":"./esm/index.mjs"},"require":{"types":"./cjs/index.d.ts","default":"./cjs/index.js"},"default":"./cjs/index.js"}},"sideEffects":false,"repository":{"type":"git","url":"git+https://github.com/ItsBenCodes/cookies.git"},"bugs":{"url":"https://github.com/ItsBenCodes/cookies/issues"},"homepage":"https://github.com/ItsBenCodes/cookies/tree/main/packages/universal-cookie#readme","keywords":["universal","isomophic","cookie"],"author":{"name":"Benoit Tremblay","email":"me@ben.codes"},"license":"MIT","scripts":{"prebuild":"rimraf esm && rimraf cjs && rimraf umd","build":"rollup -c"},"dependencies":{"cookie":"^1.1.1"},"devDependencies":{"@babel/cli":"^7.28.6","rimraf":"^6.1.3","rollup":"^4.60.1","typescript":"^6.0.2"},"gitHead":"54f246ee61c487792331d42f40f2a34960ba2a5b","_id":"universal-cookie@8.1.2","_nodeVersion":"22.14.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-kcKzTGNsxVytujrYOvQbvh//QyFrA53HrzCGyzh6i9ujCww5gfPrLK0tG+jJD40SIIldiEjBNPPSR8fBMS21GA==","shasum":"2faf7fb206575e658d5bfb999021b7f5fed81cf5","tarball":"http://registry-npm.ywwl.com/universal-cookie/download/universal-cookie-8.1.2.tgz","fileCount":19,"unpackedSize":63653,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/universal-cookie@8.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIA8ppak/ZZJ6Sq/qksocV2IhagKS4Jj6YY7AvStLwx4fAiBJYPJvy8EGDh7MdkWBOxiYxAUc/99zlCi/5saD6yMJ0Q=="}],"size":14524,"noattachment":false,"key":"/universal-cookie/-/universal-cookie-8.1.2.tgz"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:f960f8b7-3d02-4ccd-9134-7f8743d15bb2"}},"directories":{},"maintainers":[{"name":"exon","email":"trembl.ben@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/universal-cookie_8.1.2_1777495426603_0.2530484735612408"},"_hasShrinkwrap":false,"readme":"<h3 align=\"center\">\n  universal-cookie\n</h3>\n\n<p align=\"center\">\n  Universal cookies for JavaScript<br />\n  <a href=\"https://badge.fury.io/js/universal-cookie\"><img src=\"https://badge.fury.io/js/universal-cookie.svg\" /></a>\n  <img src=\"https://github.com/github/docs/actions/workflows/test.yml/badge.svg\" />\n</p>\n\n## Integrations\n\n- [`react-cookie`](https://www.npmjs.com/package/react-cookie) - Universal cookies for React\n- [`universal-cookie-express`](https://www.npmjs.com/package/universal-cookie-express) - Hook cookies get/set on Express for server-rendering\n\n## Getting started\n\n`npm install universal-cookie`\n\nor in the browser (global variable `UniversalCookie`):\n\n```html\n<script\n  crossorigin\n  src=\"https://unpkg.com/universal-cookie@7/umd/universalCookie.min.js\"\n></script>\n```\n\n## API - Cookies class\n\n### `constructor([cookieHeader], [defaultSetOptions])`\n\nCreate a cookies context\n\n- cookieHeader (string|object): specify the cookie header or object\n- defaultSetOptions (object): specify the default options when setting cookies\n  - path (string): cookie path, use `/` as the path if you want your cookie to be accessible on all pages\n  - expires (Date): absolute expiration date for the cookie\n  - maxAge (number): relative max age of the cookie from when the client receives it in seconds\n  - domain (string): domain for the cookie (sub.domain.com or .allsubdomains.com)\n  - secure (boolean): Is only accessible through HTTPS?\n  - httpOnly (boolean): Is only the server can access the cookie? **Note: You cannot get or set httpOnly cookies from the browser, only the server.**\n  - sameSite (boolean|none|lax|strict): Strict or Lax enforcement\n  - partitioned (boolean): Indicates that the cookie should be stored using partitioned storage\n\n### `get(name, [options])`\n\nGet a cookie value\n\n- name (string): cookie name\n- options (object):\n  - doNotParse (boolean): do not convert the cookie into an object no matter what\n\n### `getAll([options])`\n\nGet all cookies\n\n- options (object):\n  - doNotParse (boolean): do not convert the cookie into an object no matter what\n\n### `set(name, value, [options])`\n\nSet a cookie value\n\n- name (string): cookie name\n- value (string|object): save the value and stringify the object if needed\n- options (object): Support all the cookie options from RFC 6265\n  - path (string): cookie path, use `/` as the path if you want your cookie to be accessible on all pages\n  - expires (Date): absolute expiration date for the cookie\n  - maxAge (number): relative max age of the cookie from when the client receives it in seconds\n  - domain (string): domain for the cookie (sub.domain.com or .allsubdomains.com)\n  - secure (boolean): Is only accessible through HTTPS?\n  - httpOnly (boolean): Is only the server can access the cookie? **Note: You cannot get or set httpOnly cookies from the browser, only the server.**\n  - sameSite (boolean|none|lax|strict): Strict or Lax enforcement\n  - partitioned (boolean): Indicates that the cookie should be stored using partitioned storage\n\n### `remove(name, [options])`\n\nRemove a cookie\n\n- name (string): cookie name\n- options (object): Support all the cookie options from RFC 6265\n  - path (string): cookie path, use `/` as the path if you want your cookie to be accessible on all pages\n  - expires (Date): absolute expiration date for the cookie\n  - maxAge (number): relative max age of the cookie from when the client receives it in seconds\n  - domain (string): domain for the cookie (sub.domain.com or .allsubdomains.com)\n  - secure (boolean): Is only accessible through HTTPS?\n  - httpOnly (boolean): Is only the server can access the cookie? **Note: You cannot get or set httpOnly cookies from the browser, only the server.**\n  - sameSite (boolean|none|lax|strict): Strict or Lax enforcement\n  - partitioned (boolean): Indicates that the cookie should be stored using partitioned storage\n\n### `addChangeListener(callback)`\n\nAdd a listener to when a cookie is set or removed.\n\n- callback (function): Call that will be called with the first argument containing `name`, `value` and `options` of the changed cookie.\n\n### `removeChangeListener(callback)`\n\nRemove a listener from the change callback.\n\n### `removeAllChangeListeners()`\n\nRemove all change listeners that were previously added with `addChangeListener()`.\n\n### `update()`\n\nRead back the cookies from the browser and triggers the change listeners. This should normally not be necessary because this library detects cookie changes automatically.\n\n## Browser Example\n\n```js\nimport Cookies from 'universal-cookie';\n\nconst cookies = new Cookies(null, { path: '/' });\n\ncookies.set('myCat', 'Pacman');\nconsole.log(cookies.get('myCat')); // Pacman\n```\n\n## Server Example\n\n```js\nimport Cookies from 'universal-cookie';\n\nconst cookies = new Cookies(req.headers.cookie, { path: '/' });\n\nconsole.log(cookies.get('myCat')); // Pacman or undefined if not set yet\n```\n","publish_time":1777495426739,"_cnpm_publish_time":1777495426739,"dist-tags":{"latest":"8.1.2"}}