
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
npm install js.cookie --save
import Cookie from "js.cookie";
// Set cookie
Cookie.set(
"name", // @string
"john", // @string, @number, @object
{ // @object (options, not necessary)
domain: "example.com", // @string | default: current domain
path: "/path", // @string | default: "/"
secure: true, // @boolean | default: false
expires: "Tue, 19 Jan 2038 03:14:07 GMT", // @string (in GMT format) | default: session cookie
live: 1 // @number (days of life) | default: session cookie
}
); // > "john" | @string
// Get cookie
Cookie.get( "name" ); // > "john" | @string
// Remove cookie
Cookie.remove( "name" ); // > "john" | @string
Cookie.get( "name" ); // > undefined
Cookie.set( "obj", {foo: "bar"} ); // > {foo: "bar"} | @object
Cookie.get( "obj" ); // > {foo: "bar"} | @object
Cookie.set( "num", 1 ); // > 1 | @number
Cookie.get( "num" ); // > 1 | @number
FAQs
Object to work with cookies
The npm package js.cookie receives a total of 2,929 weekly downloads. As such, js.cookie popularity was classified as popular.
We found that js.cookie 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.