# hc_localstorage_plus

> A localStorage wrapper that uses JavaScript Proxy to automatically sync changes to the localStorage.

Latest version **1.1.1** (published 2023-03-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install hc_localstorage_plus
pnpm add hc_localstorage_plus
yarn add hc_localstorage_plus
bun add hc_localstorage_plus
```

Provides the command `axiosPlus`.

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2023-03-30 |
| First published | 2023-03-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 183.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | haocheni |
| Maintainers | haocheni |
| Keywords | localstorage |

## Links

- npm: https://www.npmjs.com/package/hc_localstorage_plus
- Repository: https://github.com/tanghaochen/localstorage-plus
- Homepage: https://github.com/tanghaochen/localstorage-plus#readme
- Issues: https://github.com/tanghaochen/localstorage-plus/issues
- npm.io page: https://npm.io/package/hc_localstorage_plus

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

- 1.1.1 (latest) — 2023-03-30
- 1.0.1 — 2023-03-29
- 1.0.0 — 2023-03-29

## README

## How
`npm i hc_localstorage_plus`

## What
避免了繁琐的手动存储操作，并提供了更高的数据访问和修改安全性。
这使得代码更加**简洁**易读，易于维护和扩展。

## why?
Former:
`JSON.parse(localStorage.getItem(${key})) || {};`❌

optimization: 
`myLocalStorage.${key}`✅

## Example
```ts
const key = "myObject";
const initialData = {
    initData: "newData",
};

const myLocalStorage = new ProxiedLocalStorage(key, initialData);
// set it = localStorage.setItem(${key}, ${value})
myLocalStorage.initData = "change";
// get it = localStorage.getItem(${key}, ${value})
console.log(myLocalStorage.initData)
```

### Effect
![effct](./assets/effect.png)

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