# mit.db

> An easy and quick database

Latest version **2023.4.12** (published 2023-04-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install mit.db
pnpm add mit.db
yarn add mit.db
bun add mit.db
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2023.4.12 |
| Published | 2023-04-12 |
| First published | 2022-12-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 46.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | ThunderNetworkRaD \| Killer Boss Original |
| Maintainers | killerbossoriginal |

## Links

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

## Recent versions

- 2023.4.12 (latest) — 2023-04-12
- 2023.2.23-1 — 2023-02-23
- 2023.2.2-3.4 — 2023-02-23
- 2023.2.23 — 2023-02-23
- 2023.2.6 — 2023-02-06
- 2023.2.5-2 — 2023-02-05
- 2023.2.5-1 — 2023-02-05
- 2023.2.5 — 2023-02-05
- 2022.12.29 — 2022-12-29

## README

# Mit.db

```js
const MitDB = require('mit.db');
const db = new MitDB('file.db'); // this is the save file's name + extension
async function sample() {
    // assuming 'somekey' exists in the Map and has a value { cool: false }
    const data = db.get('somekey');
    // reassigning the 'cool' property a new value
    data.cool = true;
    await db.set('somekey', data);
    // now 'somekey' has a new value { cool: true }
}
```

### Docs

#### Installation

With **npm**:

`npm i mit.db`


#### Setup

```js
const MitDB = require('mit.db')
const db = new MitDB('database.json') // this is the save file's name + extension
```

#### set()

```js
    await db.set('ciao', 'hello')
    await db.set('arrivederci', 'bye')
```

#### get()

```js
var ansa = db.get('ciao') // ansa = hello
```

#### has()

```js
var asnb = db.has('arrivederci') // ansb = true
```

#### entries()

```js
var ansc = db.entries() // ansc = [ 'ciao', 'hello' ], [ 'arrivederci', 'bye' ] ]
```

#### keys()

```js
var ansd = db.keys() // ansd = [ 'ciao', 'arrivederci' ]
```

#### values()

```js
var anse = db.values() // anse = [ 'hello', 'bye' ]
```

#### forEach()

```js
db.forEach((value, key) => console.log(value, key)) // console.log = hello ciao
// console.log = bye arrivederci
```

#### delete()

```js
// [{"key":"ciao","value":"hello"}, {"key":"arrivederci","value":"bye"}]
await db.delete('ciao')
// [{"key":"arrivederci","value":"bye"}]
```

#### clear()

```js
// [{"key":"ciao","value":"hello"}, {"key":"arrivederci","value":"bye"}]
await db.delete('ciao')
// []
```

#### size()

```js
// [{"key":"ciao","value":"hello"}, {"key":"arrivederci","value":"bye"}]
var ansf = db.size() // size = 2
```

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