Socket
Book a DemoInstallSign in
Socket

@glorious/cookie

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@glorious/cookie

The tiniest cookie library

latest
npmnpm
Version
0.3.0
Version published
Maintainers
1
Created
Source

CircleCI codecov Code Climate

Install

Glorious Cookie is available via npm:

npm i @glorious/cookie --save

Once installed, you just need import it in your module:

import gcookie from '@glorious/cookie';

or you may include it on your html:

<script src="/node_modules/@glorious/cookie/dist/gcookie.min.js"></script>

Usage

Intending to be as simple as possible, Glorious Cookie has only three methods.

Set

/*
** @key: String [required]
** @value: String [required]
** @days: Number [optional] - If not provided, cookie is removed when the user closes the browser.
** @path: String [optional] - If not provided, cookie is valid for the entire site.
*/
gcookie.set(key, value, days, path);

Get

/*
** @key: String [optional] - If not provided, all cookies will be returned.
*/
gcookie.get(key);

Remove

/*
** @key: String [required]
** @path: String [optional] - If you have specified a path on gcookie.set(),
**                            it will be required here.
*/
gcookie.remove(key, path);

Note: If cookies are not available, a warning will be logged when trying to set or remove a cookie.

FAQs

Package last updated on 27 Aug 2018

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