Socket
Book a DemoInstallSign in
Socket

@festardoctor/utils-storage

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@festardoctor/utils-storage

基础存储组件

0.0.2
latest
npmnpm
Version published
Maintainers
3
Created
Source

组件说明

存储组件,包含sessionStorage、localStorage、和Cookie的操作.

  • cookie操作类 Cookie
  • session操作和cookie操作类 SyncStorage
  • localstorage操作类 MtLocalStorage

组件引入方式

import { Cookie,SyncStorage,MtLocalStorage} from '@festardoctor/utils-storage';


方法调用说明

//获取所有的cookie值,以map格式返回
Cookie.getCookiesObj();

/**
 *
 * @param name  名称
 * @param value 值
 * @param opts  对象key包含:maxAge, path, domain, secure
 * @returns {*}
 */
Cookie.set(name,value,opts);

//获取cookie值
Cookie.get(name);

//删除值
Cookie.remove(name);

//清除cookie
Cookie.clear();

//获取所有的cookie值,以map格式返回 等同于getCookieObj();
Cookie.getCookies();

session操作和cookie操作类 SyncStorage

//同时往sessionstorage和cookie中写入数据.
SyncStorage.set(name,value);

//优先从sessionstorage获取数据,如果没有,则从cookie中获取.
SyncStorage.get(name);

//从sessionstorage和cookie中删除数据.
SyncStorage.remove(name);

//清空sessionstorage和cookie
SyncStorage.clear();

localstorage操作类 MtLocalStorage

//localstorage存储值
MtLocalStorage.set(name,value);

//localstorage取值
MtLocalStorage.get(name);

//localstorage删除值
MtLocalStorage.remove(name);

//清空localstorage
MtLocalStorage.clear();

FAQs

Package last updated on 14 Jan 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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.