cypress-io / strict-cookie-parser

A JavaScript cookie parsing module.

Home Page:https://www.npmjs.com/package/strict-cookie-parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build status

Parses cookie headers according to RFC 6265, producing a Map.

For Connect (Express) middleware, see strict-cookie-middleware.

const strictCookieParser = require('strict-cookie-parser');

strictCookieParser.parseCookieHeader('hello=world; foo=bar ')
// Map { hello => 'world', foo => 'bar' }

strictCookieParser.parseCookieHeader('not a cookie')
// null

strictCookieParser.parseCookiePair('single=pair')
// { name: 'single', value: 'pair' }

strictCookieParser.isCookieName('foo')
// true

strictCookieParser.isCookieName('m=m')
// invalid - cookie names cannot contain =
// false

strictCookieParser.parseCookieValue('"foo"')
// 'foo'

strictCookieParser.parseCookieValue(' foo')
// invalid - unquoted cookie values cannot begin with a space
// null

About

A JavaScript cookie parsing module.

https://www.npmjs.com/package/strict-cookie-parser

License:ISC License


Languages

Language:JavaScript 100.0%