{"id":28226047,"url":"https://github.com/rh1tech/zoia-cookies","last_synced_at":"2026-06-13T15:33:23.479Z","repository":{"id":57406434,"uuid":"216632154","full_name":"rh1tech/zoia-cookies","owner":"rh1tech","description":"A fork of Cookies.js library by Scott Hamper","archived":false,"fork":false,"pushed_at":"2019-10-21T18:39:03.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-29T19:42:13.828Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rh1tech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-21T17:59:31.000Z","updated_at":"2025-03-11T23:29:38.000Z","dependencies_parsed_at":"2022-09-26T17:01:53.038Z","dependency_job_id":null,"html_url":"https://github.com/rh1tech/zoia-cookies","commit_stats":null,"previous_names":["rh1tech/zoia-cookies"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rh1tech/zoia-cookies","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rh1tech%2Fzoia-cookies","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rh1tech%2Fzoia-cookies/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rh1tech%2Fzoia-cookies/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rh1tech%2Fzoia-cookies/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rh1tech","download_url":"https://codeload.github.com/rh1tech/zoia-cookies/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rh1tech%2Fzoia-cookies/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34290345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-18T11:10:12.488Z","updated_at":"2026-06-13T15:33:23.445Z","avatar_url":"https://github.com/rh1tech.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zoia-cookies\n\nzoia-cookies is a small client-side javascript library that makes managing cookies easy.\n\nIt is a fork of Cookies.js originally developed by Scott Hamper (\u003chttps://github.com/ScottHamper/Cookies\u003e).\n\n[Features](#features)\u003cbr\u003e\n[Browser Compatibility](#browser-compatibility)\u003cbr\u003e\n[Getting the Library](#getting-the-library)\u003cbr\u003e\n[Use in CommonJS/Node Environments Without `window`](#use-in-commonjsnode-environments-without-window)\u003cbr\u003e\n[A Note About Encoding](#a-note-about-encoding)\u003cbr\u003e\n[API Reference](#api-reference)\n\n## Features\n\n- [RFC6265](http://www.rfc-editor.org/rfc/rfc6265.txt) compliant\n- Cross browser\n- Lightweight\n- No dependencies\n- MIT License\n- Supports AMD / CommonJS loaders\n\n### Node Package Manager\n\n`npm install zoia-cookies`\n\n## Use in CommonJS/Node Environments Without `window`\n\nIn environments where there is no native `window` object, zoia-cookies will export a factory method that accepts a `window` instance. For example, using [jsdom](https://github.com/tmpvar/jsdom), you might do something like:\n\n```javascript\nvar jsdom = require('jsdom');\nvar window = jsdom.jsdom().parentWindow;\nvar Cookies = require('zoia-cookies')(window);\n\n// Use Cookies as you normally would\n```\n\n## A Note About Encoding\n\n[RFC6265](http://www.rfc-editor.org/rfc/rfc6265.txt) defines a strict set of allowed characters for cookie keys and values. In order to effectively allow any character to be used in a key or value, zoia-cookies will URI encode disallowed characters in their UTF-8 representation. As such, zoia-cookies also expects cookie keys and values to already be URI encoded in a UTF-8 representation when it accesses cookies. Keep this in mind when working with cookies on the server side.\n\n### .NET Users\n\nDo not use [HttpUtility.UrlEncode](http://msdn.microsoft.com/en-us/library/4fkewx0t.aspx) and [HttpUtility.UrlDecode](http://msdn.microsoft.com/en-us/library/adwtk1fy.aspx) on cookie keys or values. `HttpUtility.UrlEncode` will improperly escape space characters to `'+'` and lower case every escape sequence. `HttpUtility.UrlDecode` will improperly unescape every `'+'` to a space character. Instead, use [System.Uri.EscapeDataString](http://msdn.microsoft.com/en-us/library/system.uri.escapedatastring.aspx) and [System.Uri.UnescapeDataString](http://msdn.microsoft.com/en-us/library/system.uri.unescapedatastring.aspx).\n\n## API Reference\n\n**Methods**\u003cbr\u003e\n[Cookies.set(key, value [, options])](#cookiessetkey-value--options)\u003cbr\u003e\n[Cookies.get(key)](#cookiesgetkey)\u003cbr\u003e\n[Cookies.expire(key [, options])](#cookiesexpirekey--options)\n\n**Properties**\u003cbr\u003e\n[Cookies.enabled](#cookiesenabled)\u003cbr\u003e\n[Cookies.defaults](#cookiesdefaults)\n\n### Methods\n\n#### Cookies.set(key, value [, options])\n\n_Alias: Cookies(key, value [, options])_\n\nSets a cookie in the document. If the cookie does not already exist, it will be created. Returns the `Cookies` object.\n\n* _path_: a string value of the path of the cookie (default: \"/\")\n* _domain_: a string value of the domain of the cookie (default: undefined)\n* _expires_: a number (of seconds), a date parsable string, or a `Date` object of when the cookie will expire (default: undefined)\n* _secure_: a boolean value of whether or not the cookie should only be available over SSL (default: false)\n* _sameSite_: use \"SameSite\" cookie attribute? Value is one of: undefined, strict, lax (default: undefined)\n\nA default value for any option may be set in the `Cookies.defaults` object.\n\n**Example Usage**\n\n```javascript\n// Setting a cookie value\nCookies.set('key', 'value');\n\n// Chaining sets together\nCookies.set('key', 'value').set('hello', 'world');\n\n// Setting cookies with additional options\nCookies.set('key', 'value', { domain: 'www.example.com', secure: true });\n\n// Setting cookies with expiration values\nCookies.set('key', 'value', { expires: 600 }); // Expires in 10 minutes\nCookies.set('key', 'value', { expires: '01/01/2012' });\nCookies.set('key', 'value', { expires: new Date(2012, 0, 1) });\nCookies.set('key', 'value', { expires: Infinity });\n\n// Using the alias\nCookies('key', 'value', { secure: true });\n```\n\n#### Cookies.get(key)\n\n_Alias: Cookies(key)_\n\nReturns the value of the most locally scoped cookie with the specified key.\n\n**Example Usage**\n\n```javascript\n// First set a cookie\nCookies.set('key', 'value');\n\n// Get the cookie value\nCookies.get('key'); // \"value\"\n\n// Using the alias\nCookies('key'); // \"value\"\n```\n\n#### Cookies.expire(key [, options])\n\n_Alias: Cookies(key, `undefined` [, options])_\n\nExpires a cookie, removing it from the document. Returns the `Cookies` object.\n\n  Option | Description                                | Default\n-------: | ------------------------------------------ | -----------\n  _path_ | A string value of the path of the cookie   | `\"/\"`\n_domain_ | A string value of the domain of the cookie | `undefined`\n\nA default value for any option may be set in the `Cookies.defaults` object.\n\n**Example Usage**\n\n```javascript\n// First set a cookie and get its value\nCookies.set('key', 'value').get('key'); // \"value\"\n\n// Expire the cookie and try to get its value\nCookies.expire('key').get('key'); // undefined\n\n// Using the alias\nCookies('key', undefined);\n```\n\n### Properties\n\n#### Cookies.enabled\n\nA boolean value of whether or not the browser has cookies enabled.\n\n**Example Usage**\n\n```javascript\nif (Cookies.enabled) {\n    Cookies.set('key', 'value');\n}\n```\n\n#### Cookies.defaults\n\nAn object representing default options to be used when setting and expiring cookie values.\n\n   Option | Description                                                                                      | Default\n--------: | ------------------------------------------------------------------------------------------------ | -----------\n   _path_ | A string value of the path of the cookie                                                         | `\"/\"`\n _domain_ | A string value of the domain of the cookie                                                       | `undefined`\n_expires_ | A number (of seconds), a date parsable string, or a `Date` object of when the cookie will expire | `undefined`\n _secure_ | A boolean value of whether or not the cookie should only be available over SSL                   | `false`\n\n**Example Usage**\n\n```javascript\nCookies.defaults = {\n    path: '/',\n    secure: true\n};\n\nCookies.set('key', 'value'); // Will be secure and have a path of '/'\nCookies.expire('key'); // Will expire the cookie with a path of '/'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frh1tech%2Fzoia-cookies","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frh1tech%2Fzoia-cookies","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frh1tech%2Fzoia-cookies/lists"}