{"name":"universal-cookie","version":"8.1.1","keywords":["universal","isomophic","cookie"],"author":{"name":"Benoit Tremblay","email":"me@ben.codes"},"license":"MIT","_id":"universal-cookie@8.1.1","maintainers":[{"name":"exon","email":"trembl.ben@gmail.com"}],"homepage":"https://github.com/ItsBenCodes/cookies/tree/main/packages/universal-cookie#readme","bugs":{"url":"https://github.com/ItsBenCodes/cookies/issues"},"dist":{"shasum":"22acc1508f7fffae0ad8342a2e7fd4867ce4bd0e","tarball":"http://registry-npm.ywwl.com/universal-cookie/download/universal-cookie-8.1.1.tgz","fileCount":23,"integrity":"sha512-0wTDiq7TyvJz7YsswNMKWns4ZGJjO2RBFuVlyKiIDkBKc1mceMxjGwGlIcGFHp+xT4OZKOI7XF7jRCnCavC7Mg==","signatures":[{"sig":"MEQCIHyrO9a9RtS+fgxVw4oFmC+YjowCnx4iEJMv3fNq8FG1AiAwq/twexYghxkdE/7sPOzrrfpxS6mWzgndS/jV+ElAVQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":65609,"size":14654,"noattachment":false,"key":"/universal-cookie/-/universal-cookie-8.1.1.tgz"},"main":"cjs/index.js","types":"cjs/index.d.ts","module":"esm/index.mjs","exports":{".":{"import":{"types":"./esm/index.d.ts","default":"./esm/index.mjs"},"default":"./cjs/index.js","require":{"types":"./cjs/index.d.ts","default":"./cjs/index.js"}}},"gitHead":"bf73d74b93c48164db27ab22efa140df99f8489d","scripts":{"build":"rollup -c","prebuild":"rimraf esm && rimraf cjs && rimraf umd"},"_npmUser":{"name":"exon","email":"trembl.ben@gmail.com"},"repository":{"url":"git+https://github.com/ItsBenCodes/cookies.git","type":"git"},"_npmVersion":"11.9.0","description":"Universal cookies for JavaScript","directories":{},"sideEffects":false,"_nodeVersion":"24.14.0","dependencies":{"cookie":"^1.1.1"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^6.1.3","rollup":"^4.60.1","@babel/cli":"^7.28.6","typescript":"^6.0.2"},"_npmOperationalInternal":{"tmp":"tmp/universal-cookie_8.1.1_1777479698115_0.337951667535455","host":"s3://npm-registry-packages-npm-production"},"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":1777479698304,"_cnpm_publish_time":1777479698304,"dist-tags":{"latest":"8.1.2"}}