Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
cookie-monster
Advanced tools
Browserify-compatible module to get and set cookies in the browser
NOTE: cookie-monster is a fork of cookie-cutter by substack (James Halliday), which seems to have gone stale.
Set and get cookies in the browser or in node with document
.
In your browser code with browserify:
var cookie = require('cookie-monster');
var times = parseInt(cookie.getItem('times'), 10) || 0;
cookie.setItem('times', times + 1);
and times
will increment every time the page is reloaded.
var cookie = require('cookie-monster');
Return a new cookie object with .getItem()
, .setItem()
, .removeItem()
and .clear()
operating on document
. Older version's .get()
, .set()
and .remove()
methods are left for backward compatibility, but their usage is highly discouraged.
document.cookie
should be a non-referentially transparent setter/getter combo
like the DOM's variant where assignment with optional path and expiry creates a
new cookie in the getter as a key=value pair.
Return the cookie value for key
. Aliased by cookie.get()
.
Set the cookie at key
to value
with optional parameters expires
and path
. Aliased by cookie.set()
.
Removes cookie value stored at key
. Aliased by cookie.remove()
.
Alternatively you can use .setItem()
with { expires: new Date(0) }
option to unset a cookie.
Removes all currently available cookies.
With npm do:
npm install cookie-monster
With the console do
$ npm test
MIT/X11
FAQs
Browserify-compatible module to get and set cookies in the browser
The npm package cookie-monster receives a total of 412 weekly downloads. As such, cookie-monster popularity was classified as not popular.
We found that cookie-monster demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.