Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/charmander/strict-cookie-parser
A JavaScript cookie parsing module.
https://github.com/charmander/strict-cookie-parser
cookie nodejs
Last synced: 3 months ago
JSON representation
A JavaScript cookie parsing module.
- Host: GitHub
- URL: https://github.com/charmander/strict-cookie-parser
- Owner: charmander
- License: isc
- Created: 2015-03-27T03:57:31.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2021-05-27T00:34:23.000Z (over 3 years ago)
- Last Synced: 2024-09-24T14:18:20.542Z (3 months ago)
- Topics: cookie, nodejs
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/strict-cookie-parser
- Size: 69.3 KB
- Stars: 3
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build status][ci-image]][ci]
Parses cookie headers according to [RFC 6265][], producing a [Map][].
For Connect (Express) middleware, see [strict-cookie-middleware][].
```javascript
import { parseCookieHeader } from 'strict-cookie-parser';parseCookieHeader('hello=world; foo=bar')
// Map { 'hello' => 'world', 'foo' => 'bar' }parseCookieHeader('not a cookie')
// null
``````javascript
import {
parseCookiePair,
isCookieName,
parseCookieValue,
} from 'strict-cookie-parser';parseCookiePair('single=pair')
// { name: 'single', value: 'pair' }isCookieName('foo')
// trueisCookieName('m=m')
// invalid - cookie names cannot contain =
// falseparseCookieValue('"foo"')
// 'foo'parseCookieValue(' foo')
// invalid - unquoted cookie values cannot begin with a space
// null
```[RFC 6265]: https://tools.ietf.org/html/rfc6265
[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
[strict-cookie-middleware]: https://github.com/charmander/strict-cookie-middleware[ci]: https://github.com/charmander/strict-cookie-parser/actions
[ci-image]: https://github.com/charmander/strict-cookie-parser/workflows/Node%20CI/badge.svg