1.0.1 • Published 9 months ago

@likg/storage v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
9 months ago

Storage

为了方便对JSAPI LocalStorage的使用,这里封装lg-storage库简化操作。

# 安装
$ yarn add @likg/storage
# OR
$ npm install @likg/storage

API

/**
 * 存储数据
 * @param key 键
 * @param value 值
 */
static set(key: string, value: any): void;
/**
 * 读取数据
 * @param key 键
 * @returns
 */
static get<T = any>(key: string): T | null;
/**
 * 移除数据
 * key的类型可以为字符串、字符串数组以及undefined
 * 根据不同类型,有如下三种结果:
 * - 当key为字符串时/移除指定key对应的数据
 * - 当key为字符串数组时/遍历删除指定key对应的数据
 * - 当key为undefined时/清空所有本地数据
 * @param key
 */
static del(key?: string | string[]): void;
1.0.1

9 months ago