Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simonalling/ts-storage
Type-safe storage library with fallback values
https://github.com/simonalling/ts-storage
Last synced: 4 months ago
JSON representation
Type-safe storage library with fallback values
- Host: GitHub
- URL: https://github.com/simonalling/ts-storage
- Owner: SimonAlling
- License: mit
- Created: 2018-02-19T16:56:05.000Z (almost 7 years ago)
- Default Branch: develop
- Last Pushed: 2023-03-04T02:50:19.000Z (almost 2 years ago)
- Last Synced: 2024-10-04T22:44:40.613Z (4 months ago)
- Language: TypeScript
- Size: 719 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ts-storage
> Type-safe storage library with fallback values[![NPM Version][npm-image]][npm-url]
[![Downloads Stats][npm-downloads]][npm-url]A simple library for interacting with the browser's local storage in a type-safe manner (with TypeScript).
## Installation
```sh
npm install ts-storage --save
```## Usage
```javascript
import * as Storage from "ts-storage";Storage.set("foo", 5);
const foo = Storage.get("foo", 0).value;
// foo is guaranteed to be a number.
```[npm-image]: https://img.shields.io/npm/v/ts-storage.svg
[npm-url]: https://npmjs.org/package/ts-storage
[npm-downloads]: https://img.shields.io/npm/dm/ts-storage.svg