Cookies Monster
Small cookie parsing library
This is a small library to parse cookies from requests in Node.
Install
$ npm install cookiesmonster
Usage
const cookieMonster = require('cookiemonster');
- Parse request for cookies
const cookies = cookieMonster.get(req);
Pass a default node request, or from express etc. This returns the parsed cookies as an array of objects or empty array.
[
{
"name": "_ga",
"value": "GA1.1.206842275.1547456732"
}
]
const cookies = cookieMonster.getByName(req,'randomSite');
This return an object with the name of the site, value of the cookie and if the cookie is not found it returns null
.
{
"name": "randomSite",
"value": "9cs09ds0cisd"
}
Future features
Suggestions and pull requests welcome!