# superstore-sync

> Local storage, without the bugs.

Latest version **2.1.1** (published 2018-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install superstore-sync
pnpm add superstore-sync
yarn add superstore-sync
bun add superstore-sync
```

## 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 | 2.1.1 |
| Published | 2018-11-07 |
| First published | 2013-11-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 0 |
| Unpacked size | 8.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Maintainers | financial-times, ftlabs, kornel, mattandrews |
| Keywords | localstorage, sessionstorage |

## Links

- npm: https://www.npmjs.com/package/superstore-sync
- Repository: https://github.com/matthew-andrews/superstore-sync
- Homepage: https://github.com/matthew-andrews/superstore-sync#readme
- Issues: https://github.com/matthew-andrews/superstore-sync/issues
- npm.io page: https://npm.io/package/superstore-sync

## 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

- 2.1.1 (latest) — 2018-11-07
- 2.1.0 — 2016-02-10
- 2.0.1 — 2015-07-15
- 2.0.0 — 2015-07-10
- 1.1.0 — 2015-02-17
- 1.0.0 — 2013-11-02

## README

# superstore-sync [![Build Status](https://travis-ci.org/matthew-andrews/superstore-sync.png?branch=master)](https://travis-ci.org/matthew-andrews/superstore-sync) [![NPM version](https://badge.fury.io/js/superstore-sync.png)](http://badge.fury.io/js/superstore-sync)

Superstore is a simple lightweight synchronous wrapper around the Web Storage APIs [localStorage](https://developer.mozilla.org/en/docs/Web/API/Window/localStorage) and [sessionStorage](https://developer.mozilla.org/en/docs/Web/API/Window/sessionStorage).  Its features include:

- It is [resilient to iOS's strange behaviour in private browsing mode](http://stackoverflow.com/questions/14555347/html5-localstorage-doesnt-works-in-ios-safari-private-browsing).
- It accepts objects as values and runs `JSON.stringify` on **#set** and `JSON.parse` on **#get** for you.

If you require an asyncronous version please use [superstore](https://github.com/matthew-andrews/superstore) instead.

## install
### NPM
```
npm install superstore-sync --save
```

### bower
```
bower install superstore-sync --save
```

## api

superstore-sync is an uninstantiable module.  Its methods are:

## local

### #local.get(key)

### #local.set(key, value)

### #local.unset(key)

### #local.clear(prefix)

## session

### #session.get(key)

### #session.set(key, value)

### #session.unset(key)

### #session.clear(prefix)

## #isPersisting()
* returns a boolean set to true if data is being persisted to storage, or false if it is being kept in memory (e.g. if localStorage is full or inaccessible).

## usage
```javascript
var store = require('superstore-sync');

//Persist a value to local storage
var value = store.local.set('foo', 'bar');

//Get a value from session storage
var session = store.session.get('baz');
```

## todo

- JSDoc comments and automatically generating documentation.

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