New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

cookier

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cookier

Simple utility function to get, set and remove cookies

latest
Source
npmnpm
Version
3.1.0
Version published
Maintainers
1
Created
Source

cookier

Simple utility function to get, set and remove cookies

Install

npm install cookier

Import

import cookier from 'cookier';

Usage

Set cookies

cookier('cookieOne').set('true');
cookier('cookieTwo').set(JSON.stringify({
    keyOne: 'valueOne',
    keyTwo: 'valueTwo'
}));

Set cookies with expiry time

//sets a cookie with an expiry of 86400 seconds, or one day.
cookier('cookieOne').set('true', 1);

Get cookies

const cookieOne = cookier('cookieOne').get(); 
// this will equal 'true'
const cookieTwo = cookier('cookieTwo').get();
// this will equal '{"key":"value"}'
const cookieTwo = JSON.parse(cookier('cookieTwo').get());
/* 
this will equal:

{
    keyOne: 'valueOne',
    keyTwo: 'valueTwo'
}
*/

Remove cookies

cookier('cookieOne').remove();

Keywords

cookie

FAQs

Package last updated on 23 Jan 2019

Did you know?

Socket

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.

Install

Related posts