Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@trendyol-js/cookie-helper

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trendyol-js/cookie-helper

simple cookie helper that provides CRUD functionalities

latest
npmnpm
Version
1.0.5
Version published
Weekly downloads
590
-29.34%
Maintainers
1
Weekly downloads
 
Created
Source

simple cookie helper that provides functions to CRUD cookies

npm i @trendyol-js/cookie-helper

createCookie function will create cookie as specified.

const key = 'userId';
const value = '1234';
createCookie(key, value);

to specify a expiration date, you can pass number of days as last parameter.

const key = 'userId';
const value = '1234';
const days = 3; // number of days that the cookie will be valid
createCookie(key, value, days);

get cookies as object

getCookiesObject function will return object which contains cookies;

const cookies = getCookiesObject();

readCookie function will return the value of a given cookie name

const value = readCookie('useId');

deleteCookie function will invalidate the cookie with given name as parameter

deleteCookie('useId');

How To Build

npm install

npm run build

How To Test

npm run test

Keywords

cookies

FAQs

Package last updated on 04 Mar 2022

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