# @ricann/storage-map

> Use map structure to operate LocalStorage, SessionStorage, IndexDB and WebSQL

Latest version **0.0.3** (published 2020-08-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ricann/storage-map
pnpm add @ricann/storage-map
yarn add @ricann/storage-map
bun add @ricann/storage-map
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2020-08-21 |
| First published | 2020-08-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=8.9.0 |
| Dependencies | 0 |
| Unpacked size | 21.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | raozhanping |
| Maintainers | zhanping |
| Keywords | localStorage, sessionStorage, indexDB, storage, Map |

## Links

- npm: https://www.npmjs.com/package/@ricann/storage-map
- Repository: https://github.com/raozhanping/storage-map
- Homepage: https://github.com/raozhanping/storage-map#readme
- Issues: https://github.com/raozhanping/storage-map/issues
- npm.io page: https://npm.io/package/@ricann/storage-map

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2020-08-21
- 0.0.1 — 2020-08-20

## README

# storage-map

[![builds][builds]][builds-url]
[![licenses][licenses]][licenses-url]

  Use map structure to operate LocalStorage, SessionStorage, IndexDB and WebSQL.

## Usage

```js
const createStorage = require('@ricann/storage-map')
// Create localStorage
const storage = createStorage('localStorage')
// Create sessionStorage
const storage = createStorage('sessionStorage')

// Using storage is like using Map.
// Set a key-value to storage, and it and localStorage or sessionStorage are in sync.
storage.set('key', 'value')
```

## Interface

```ts
abstract class StorageMap<T> implements Iterable<T> {
  abstract size: number
  abstract clear(): void
  abstract delete(key: string): void
  abstract entries(): Iterator<T>
  abstract forEach(callback: Function): void
  abstract get(key: string): any
  abstract has(key: string): boolean
  abstract keys(): Iterator<string>
  abstract set(key: string, value: any): void
  abstract values(): Iterator<any>
}
```

### startup

```shell
# install dependencies
yarn install

# build for production
yarn build

# test unit
yarn run test
# test unit with covarage
yarn run test -- --covarage

# submit git log with conventional style
yarn commit
```

[builds]:https://api.travis-ci.org/raozhanping/storage-map.svg?branch=master
[builds-url]:https://travis-ci.org/github/raozhanping/storage-map
[licenses]:https://app.fossa.com/api/projects/git%2Bgithub.com%2Fraozhanping%2Fstorage-map.svg?type=shield
[licenses-url]:https://app.fossa.com/projects/git%2Bgithub.com%2Fraozhanping%2Fstorage-map?ref=badge_shield

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