Skip to content

Latest commit

 

History

History
41 lines (32 loc) · 899 Bytes

README.md

File metadata and controls

41 lines (32 loc) · 899 Bytes

Cookies Storage

Have you ever dreamed to use Cookies like you use LocalStorage ? hum? And If I say that this lib is very light ? hum ?

Happy Cookie Storage !

Install

npm i @ncisrc/cookies-storage

Use

import { cookiesStorage } from "cookies-storage"

cookieStorage.setItem(key, value);
const value = cookieStorage.getItem(key);

You can change some cookies options with the third parameter

cookieStorage.setItem(key, value, {maxAge: 60});

Options

Default 'options' values

options = {
  maxAge   : 604800, // 7 days
  sameSite : 'Strict',
  path     : '/',
  secure   : true,
  httpOnly : false,
}

You'll find more about theses options in this page :