# simpled-db

> A promise-based wrapper for indexeddb with a simplified API.

Latest version **1.3.0** (published 2019-11-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install simpled-db
pnpm add simpled-db
yarn add simpled-db
bun add simpled-db
```

## 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.3.0 |
| Published | 2019-11-14 |
| First published | 2019-11-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 508.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jon Meyers |
| Maintainers | iamqaz |
| Keywords | simple, database, indexeddb, storage, local, fast |

## Links

- npm: https://www.npmjs.com/package/simpled-db
- Repository: https://github.com/dijonmusters/simpled-db
- Homepage: https://github.com/dijonmusters/simpled-db#readme
- Issues: https://github.com/dijonmusters/simpled-db/issues
- npm.io page: https://npm.io/package/simpled-db

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.3.0 (latest) — 2019-11-14
- 1.2.0 — 2019-11-12
- 1.1.0 — 2019-11-11
- 1.0.4 — 2019-11-04
- 1.0.3 — 2019-11-03
- 1.0.2 — 2019-11-03
- 1.0.1 — 2019-11-03

## README

# Simpled DB

A promise-based wrapper for indexeddb with a simplified API. Think localStorage but for object storage!

## Getting Started

These instructions will get you a copy of the project up and running on your local machine for development.

### Prerequisites

You will need to download Node.js by visiting their ![downloads](https://nodejs.org/en/) page and following their installaion instructions.

### Installing

Use npm to install the package.

```
npm i simpled-db
```

Import package in ES6 project.

```
import db from 'simpled-db';
```

#### Using Promises

**Write data to db**

```
set('db-name', 'key', data)
```

Example

```
const todo = {
  title: 'Learn how to use simple-db',
  description: 'Follow the instructions to learn how to use simple-db',
  isComplete: false
};

db.set('todos', 'learn', todo)
  .then(() => console.log('successfully saved todo in db'));
```

**Get todo from db**

```
get('db-name', 'key')
```

Example

```
db.get('todos', 'learn')
  .then(todo => console.log(todo));
```

**Get all todos from db**

```
get('db-name')
```

Example

```
db.get('todos')
  .then(todos => console.log(todos));
```

**Remove todo from db**

```
remove('db-name', 'key')
```

Example

```
db.remove('todos', 'learn')
  .then(() => console.log('Removed todo from db'));
```

**Remove all todos from db**

```
clear('db-name')
```

Example

```
db.clear('todos')
  .then(() => console.log('Removed all todos from db'));
```

#### Using Async/Await

**Write data to db**

```
set('db-name', 'key', data)
```

Example

```
const todo = {
  title: 'Learn how to use simple-db',
  description: 'Follow the instructions to learn how to use simple-db',
  isComplete: false
};

await db.set('todos', 'learn', todo);
console.log('successfully saved todo in db');
```

**Get todo from db**

```
get('db-name', 'key')
```

Example

```
const todo = await db.get('todos', 'learn');
console.log(todo);
```

**Get all todos from db**

```
get('db-name')
```

Example

```
const todos = await db.get('todos');
console.log(todos);
```

**Remove todo from db**

```
remove('db-name', 'key')
```

Example

```
await db.remove('todos', 'learn')
console.log('Removed todo from db');
```

**Remove all todos from db**

```
clear('db-name')
```

Example

```
await db.clear('todos');
console.log('Removed all todos from db');
```

## Versioning

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/your/project/tags).

## Author

**Jon Meyers** - [dijonmusters](https://github.com/dijonmusters)

## License

This project is licensed under the MIT License.

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