{"name":"universal-cookie","version":"2.0.0","description":"Universal cookies made easy for client and server side","main":"lib/index.js","files":["lib"],"repository":{"type":"git","url":"git+https://github.com/reactivestack/cookies.git"},"bugs":{"url":"https://github.com/reactivestack/cookies/issues"},"homepage":"https://github.com/reactivestack/cookies/packages/universal-cookie/#readme","keywords":["universal","isomophic","cookie"],"author":{"name":"Benoit Tremblay","email":"benoit@reactivestack.com"},"license":"MIT","scripts":{"build":"rimraf lib && babel src -d lib --ignore __tests__","lint":"eslint --ext .js .","test":"npm run lint && karma start --single-run","watch":"karma start"},"dependencies":{"cookie":"^0.3.1","is-node":"^1.0.2","object-assign":"^4.1.0"},"_id":"universal-cookie@2.0.0","_shasum":"891b2a1d795af1bc1f0d72fea6c19daa47aa09ac","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"exon","email":"trembl.ben@gmail.com"},"dist":{"shasum":"891b2a1d795af1bc1f0d72fea6c19daa47aa09ac","tarball":"http://registry-npm.ywwl.com/universal-cookie/download/universal-cookie-2.0.0.tgz","integrity":"sha512-ukgJ1uPqg1eglN2o6pPkisFAhWGJtopJ6MzR41WnzpR8sgIgZrBozDw/VtJ3DMxCQ48xhRBvySXQPF0hYOQN2Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEiDFaNG5lE1vdm8IsFWoVj4uYwj3SOO5siSlvy4WW+PAiBWs/k+ykBxEvNzM6IZ7BcHrnsODbw1SkG9rhisZtMSGw=="}],"size":2112,"noattachment":false,"key":"/universal-cookie/-/universal-cookie-2.0.0.tgz"},"maintainers":[{"name":"exon","email":"trembl.ben@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/universal-cookie-2.0.0.tgz_1492369217052_0.05446631973609328"},"directories":{},"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### `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":1492369218719,"_cnpm_publish_time":1492369218719,"dist-tags":{"latest":"8.1.2"}}