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

mod-cookie

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

mod-cookie

cookie operate

latest
Source
npmnpm
Version
0.1.2
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Node.js (install)

Requirements:
Node.js
npm

npm install --save mod-cookie

Usage

ES6 import for typical API call signing use case :

import ModCookie from "../src"

var name = "mod";
var age = 18;
var hoppy = ['a','b','c'];

ModCookie.setItem("name",name);
ModCookie.setItem("age",age,1);
ModCookie.setItem("hoppy",hoppy);

setTimeout(function(){
    console.log(ModCookie.getItem("age"));//undefined
    console.log(ModCookie.getItem("name"));//mod
    ModCookie.removeItem("name");
    console.log(ModCookie.getItem("name"));//undefined
    ModCookie.clear();
    console.log(ModCookie.getItem("hoppy"));//undefined
},2000)

console.log(ModCookie.getItem("name"));//"mod"
console.log(ModCookie.getItem("age"));//18
console.log(ModCookie.getItem("hoppy"));//['a','b','c']

API

[instance].setItem(key,value,expireTime);
key : /required
value : /required
expireTime : /seconds

save the key value to cookie with expireTime,if do not set expireTime, The key value will never expired!

[instance].getItem(key);
string :

get the value from cookie by the key, if the value of key is not set yet or expired will return undefinded!

[instance].removeItem(key);
CryptedString :

clear the value of cookie by key

[instance].clear();
string :

clear all value of cookie

Keywords

cookie

FAQs

Package last updated on 08 Apr 2021

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