# storage-controller

> a storage lib which support sessionStorage and localStorage with the same api

Latest version **1.0.4** (published 2018-06-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install storage-controller
pnpm add storage-controller
yarn add storage-controller
bun add storage-controller
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2018-06-13 |
| First published | 2018-06-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 26.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Ben |
| Maintainers | xuedengheng |
| Keywords | storage, html5, localStorage, sessionStorage |

## Links

- npm: https://www.npmjs.com/package/storage-controller
- Repository: https://github.com/xuedengheng/storage
- Homepage: https://github.com/xuedengheng/storage#readme
- Issues: https://github.com/xuedengheng/storage/issues
- npm.io page: https://npm.io/package/storage-controller

## Dependencies (1)

- [babel-runtime](https://npm.io/package/babel-runtime.md) ^6.0.0

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2018-06-13
- 1.0.3 — 2018-06-12
- 1.0.2 — 2018-06-12
- 1.0.1 — 2018-06-12
- 1.0.0 — 2018-06-12

## README

# storage-controller
一个本地存储工具，通过相同的api去支持`localStorage`和`sessionStorage`
## 安装

```
 npm install storage-controller --save
```

## 使用

```
 import storage from 'storage-controller'
 
 // localStorage
 storage.set(key,val) 
 
 storage.get(key, def)
 
 // sessionStorage
 storage.session.set(key, val)
 
 storage.session.get(key, val)
 
```

## API

#### set(key, val)

存储storage，key为键，val为值

#### get(key, def)

根据key去获取storage，def为默认值, 如果找不到会返回def

#### remove(key)

根据key去删除storage

#### has(key)

根据key去判断storage是否存在

#### clear()
删除所有storage

#### getAll()
获取所有storage

#### forEach(callback)
循环所有的storage，callback为回调函数

#### session `<Object>`
sessionStorage操作，继承localStorage所有api

---
_Source: https://npm.io/package/storage-controller · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
