# db-fn

> ## Case 1

Latest version **3.0.0** (published 2020-03-24) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2020-03-24 |
| First published | 2020-02-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 11.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Dejan Toteff |
| Maintainers | self_refactor |

## Links

- npm: https://www.npmjs.com/package/db-fn
- Repository: https://github.com/selfrefactor/services/tree/master/packages/db-fn
- npm.io page: https://npm.io/package/db-fn

## Dependencies (3)

- [rambdax](https://npm.io/package/rambdax.md) ^3.6.0
- [fs-extra](https://npm.io/package/fs-extra.md) ^8.1.0
- [string-fn](https://npm.io/package/string-fn.md) ^2.10.2

## Recent versions

- 3.0.0 (latest) — 2020-03-24
- 1.0.2 — 2020-03-24
- 1.0.1 — 2020-03-24
- 1.0.0 — 2020-02-24
- 0.21.0 — 2020-02-24

## README

# FileSystem DataBase

## Case 1

> One label define single database

```
const LABEL = 'foo'
const {id} = await push({a:1},LABEL)
await push({a:20},LABEL)
const allState = loadJson(LABEL)
const singleInstance = load(id)
```

## Case 2

> Two labels define `child as a file` logic

```
const LABEL = 'foo'
await save({translated:'more'},LABEL, 'mehr')
await save({translate: 'less'},LABEL, 'wenig')
const allState = loadAll(LABEL)
const singleInstance = load(LABEL, 'mehr')
const updatedInstance = await update({
  ...singleInstance,
  existingProp: 2,
  newProp: 6
})
```

## API

`save` method for direct json modification
`update` for data stored with `push`

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