Socket
Book a DemoInstallSign in
Socket

@dalisoft/cookie

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dalisoft/cookie

Cookie utility for everyone

latest
Source
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

Greenkeeper badge

Cookie utility for everyone

Note: Requires Node.js framework Response and Request instance for some methods

Features

  • Compatible with almost any Node.js framework
  • Clean code
  • Performant
  • Easy
  • UMD compatible

Installation

We recommend install via npm because of it's cache and flat node modules tree

npm i @dalisoft/cookie

then you able to import to Node.js/Browser easily

// Node.js
const Cookie = require("@dalisoft/cookie");

// Browser
// window.Cookie OR Cookie

// ES6
import Cookie from "@dalisoft/cookie";

Methods

  • parse (str: string): object - Converts cookie string into object
  • stringify (str: object): string - Converts cookie object into string
  • getFromHeaders (headers: Req.Headers): object - Get cookie from header cokie field
  • set (res: Response, key: string, value: any, options?: object): void - Sets cookie
  • remove (res: Response, key: string, options?: object): void - Remove cookie

Usage

app.get("/delete_cookie", (req, res) => {
  Cookie.set(res, "deleted", true);
  Cookie.remove(res, "public_cookie");
});

License

MIT

Keywords

cookie

FAQs

Package last updated on 10 May 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