{"id":15408920,"url":"https://github.com/sec-ant/set-cookie-parser","last_synced_at":"2026-01-24T16:39:23.766Z","repository":{"id":189717320,"uuid":"681203759","full_name":"Sec-ant/set-cookie-parser","owner":"Sec-ant","description":"Yet another \"Set-Cookie\" parser","archived":false,"fork":false,"pushed_at":"2024-06-25T09:05:57.000Z","size":431,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-21T08:04:28.378Z","etag":null,"topics":["set-cookie","set-cookie-parser"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@sec-ant/set-cookie-parser/v/latest","language":"TypeScript","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/Sec-ant.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-21T13:51:24.000Z","updated_at":"2024-12-05T09:21:22.000Z","dependencies_parsed_at":"2023-08-21T13:56:52.521Z","dependency_job_id":"b47f0f2c-2457-441f-ade0-2596b089690d","html_url":"https://github.com/Sec-ant/set-cookie-parser","commit_stats":{"total_commits":67,"total_committers":3,"mean_commits":"22.333333333333332","dds":"0.17910447761194026","last_synced_commit":"47b1e9833db1dc5f0b0140e5d76c2263413cc15b"},"previous_names":["sec-ant/set-cookie-parser"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sec-ant%2Fset-cookie-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sec-ant%2Fset-cookie-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sec-ant%2Fset-cookie-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sec-ant%2Fset-cookie-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sec-ant","download_url":"https://codeload.github.com/Sec-ant/set-cookie-parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254001422,"owners_count":21997553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["set-cookie","set-cookie-parser"],"created_at":"2024-10-01T16:35:58.993Z","updated_at":"2026-01-24T16:39:23.720Z","avatar_url":"https://github.com/Sec-ant.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @sec-ant/set-cookie-parser\n\nYet another `Set-Cookie` parser.\n\n## Install\n\n```bash\nnpm i @sec-ant/set-cookie-parser\n```\n\n## Usage\n\nThis package provides three main functions: `parse`, `parseString`, and `splitCookiesString`.\n\n### `parse`\n\nThe `parse` function takes a string or an array of strings representing cookies and an options object of type `ParseOptions`. It returns an array of objects representing the parsed cookies if the `map` property of the options object is `false` or not provided. If the `map` property is `true`, it returns an object with the cookie names as keys and the parsed cookies as values.\n\n```ts\nimport { parse, ParseOptions } from \"@sec-ant/set-cookie-parser\";\n\nconst cookies = \"name=value; expires=Wed, 21 Oct 2021 07:28:00 GMT; secure\";\nconst options: ParseOptions = {\n  decodeValues: true,\n  map: true,\n};\nconst parsedCookies = parse(cookies, options);\nconsole.log(parsedCookies);\n```\n\n### `parseString`\n\nThe `parseString` function takes a string representing a single cookie and an optional configuration object of type `ParseStringOptions`. It returns an object representing the parsed cookie.\n\n```ts\nimport { parseString, ParseStringOptions } from \"@sec-ant/set-cookie-parser\";\n\nconst cookie = \"name=value; expires=Wed, 21 Oct 2021 07:28:00 GMT; secure\";\nconst options: ParseStringOptions = {\n  decodeValues: true,\n};\nconst parsedCookie = parseString(cookie, options);\nconsole.log(parsedCookie);\n```\n\n### `splitCookiesString`\n\nThe `splitCookiesString` function takes a string representing multiple cookies separated by commas. It returns an array of strings representing the individual cookies.\n\n```ts\nimport { splitCookiesString } from \"@sec-ant/set-cookie-parser\";\n\nconst cookies =\n  \"name1=value1; expires=Wed, 21 Oct 2021 07:28:00 GMT; secure, name2=value2; expires=Wed, 21 Oct 2021 07:28:00 GMT; secure\";\nconst splitCookies = splitCookiesString(cookies);\nconsole.log(splitCookies);\n```\n\n## Configuration\n\nThe `parse` and `parseString` functions accept an optional configuration object as the second parameter. The configuration object can have the following properties:\n\n- `decodeValues`: A boolean indicating whether to decode the cookie values using `decodeURIComponent`. Defaults to `true`.\n- `map`: A boolean indicating whether to return an object with the cookie names as keys and the parsed cookies as values. Only applicable to the `parse` function. Defaults to `false`.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsec-ant%2Fset-cookie-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsec-ant%2Fset-cookie-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsec-ant%2Fset-cookie-parser/lists"}