typicode/lowdb
### [`v3.0.0`](https://togithub.com/typicode/lowdb/releases/tag/v3.0.0)
[Compare Source](https://togithub.com/typicode/lowdb/compare/v2.1.0...v3.0.0)
- Switch license from "Sponsors and OSS Only" to MIT
- Use native `#` instead of TypeScript `private` keyword for adapters
- Update dependencies
- No breaking change in terms of code
**Many thanks to [Mockend](https://mockend.com) and [everyone on GitHub Sponsors](https://togithub.com/sponsors/typicode) for supporting this project** :heart: :owl:
### [`v2.1.0`](https://togithub.com/typicode/lowdb/releases/tag/v2.1.0)
[Compare Source](https://togithub.com/typicode/lowdb/compare/v2.0.3...v2.1.0)
- Add `TextFile` and `TextFileSync` adapters to simplify writing to different formats (YAML, XML, ...) and make encryption easier.
### [`v2.0.3`](https://togithub.com/typicode/lowdb/compare/v2.0.2...v2.0.3)
[Compare Source](https://togithub.com/typicode/lowdb/compare/v2.0.2...v2.0.3)
### [`v2.0.2`](https://togithub.com/typicode/lowdb/compare/v2.0.1...v2.0.2)
[Compare Source](https://togithub.com/typicode/lowdb/compare/v2.0.1...v2.0.2)
### [`v2.0.1`](https://togithub.com/typicode/lowdb/compare/v2.0.0...v2.0.1)
[Compare Source](https://togithub.com/typicode/lowdb/compare/v2.0.0...v2.0.1)
### [`v2.0.0`](https://togithub.com/typicode/lowdb/releases/tag/v2.0.0)
[Compare Source](https://togithub.com/typicode/lowdb/compare/v1.0.0...v2.0.0)
- **Out of the box and improved TypeScript support.**
- Uses new [steno](https://togithub.com/typicode/steno) version for fast async file writes.
- Uses ECMAScript modules.
- Plain JS can now be used to modify and query `db.data`
- Reduced install size.
- With native JavaScript improvements, **lodash is now optional** (you can still use it though as it provides powerful utilities).
To help with OSS funding, lowdb v2 is released under Parity license for a limited time. It'll be released under MIT license once the goal of 100 [sponsors](https://togithub.com/sponsors/typicode) is reached (currently at 55) or in five months. See [README](https://togithub.com/typicode/lowdb#readme) for complete explanation.
You can sponsor me on [GitHub Sponsors](https://togithub.com/sponsors/typicode).
Thank you!
##### Migrate
##### Lowdb v1
```js
const low = require('lowdb')
const FileSync = require('lowdb/adapters/FileSync')
const adapter = new FileSync('db.json')
const db = low(adapter)
// Set some defaults
db.defaults({ posts: [], user: {} })
.write()
// Add a post
db.get('posts')
.push({ id: 1, title: 'lowdb is awesome'})
.write()
// Set a user name using Lodash shorthand syntax
db.set('user.name', 'typicode')
.write()
```
##### Lowdb v2
```js
import { Low, FileSync } from 'lowdb'
const adapter = new FileSync('db.json')
const db = new Low(adapter)
// Set some defaults
db.data ||= { posts: [], user: {} })
db.write()
// Add a post
db.data
.posts
.push({ id: 1, title: 'lowdb is awesome'})
db.write()
// Set a user name using plain JS
db.data.user.name = 'typicode'
db.write()
```
**If you're using TypeScript, data can now be typed:**
```ts
type Post = {
id: number
title: string
}
type Data = {
posts: Post[]
}
const db = new Low(adapter)
```
**To continue using lodash with lowdb:**
```sh
npm install lodash
```
```js
import lodash from 'lodash'
// Set a user name using Lodash shorthand syntax
db.chain = lodash.chain(db.data)
db.chain
.set('user.name', 'typicode')
.value()
db.write()
```
##### Breaking changes
The following methods and properties have been removed:
- `db.getState` (use `db.data` instead)
- `db.setState` (use `db.data = ...` instead)
- `db._`
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, click this checkbox.
This PR has been generated by Mend Renovate. View repository job log here.
This PR contains the following updates:
^1.0.0
->^3.0.0
Release Notes
typicode/lowdb
### [`v3.0.0`](https://togithub.com/typicode/lowdb/releases/tag/v3.0.0) [Compare Source](https://togithub.com/typicode/lowdb/compare/v2.1.0...v3.0.0) - Switch license from "Sponsors and OSS Only" to MIT - Use native `#` instead of TypeScript `private` keyword for adapters - Update dependencies - No breaking change in terms of code **Many thanks to [Mockend](https://mockend.com) and [everyone on GitHub Sponsors](https://togithub.com/sponsors/typicode) for supporting this project** :heart: :owl: ### [`v2.1.0`](https://togithub.com/typicode/lowdb/releases/tag/v2.1.0) [Compare Source](https://togithub.com/typicode/lowdb/compare/v2.0.3...v2.1.0) - Add `TextFile` and `TextFileSync` adapters to simplify writing to different formats (YAML, XML, ...) and make encryption easier. ### [`v2.0.3`](https://togithub.com/typicode/lowdb/compare/v2.0.2...v2.0.3) [Compare Source](https://togithub.com/typicode/lowdb/compare/v2.0.2...v2.0.3) ### [`v2.0.2`](https://togithub.com/typicode/lowdb/compare/v2.0.1...v2.0.2) [Compare Source](https://togithub.com/typicode/lowdb/compare/v2.0.1...v2.0.2) ### [`v2.0.1`](https://togithub.com/typicode/lowdb/compare/v2.0.0...v2.0.1) [Compare Source](https://togithub.com/typicode/lowdb/compare/v2.0.0...v2.0.1) ### [`v2.0.0`](https://togithub.com/typicode/lowdb/releases/tag/v2.0.0) [Compare Source](https://togithub.com/typicode/lowdb/compare/v1.0.0...v2.0.0) - **Out of the box and improved TypeScript support.** - Uses new [steno](https://togithub.com/typicode/steno) version for fast async file writes. - Uses ECMAScript modules. - Plain JS can now be used to modify and query `db.data` - Reduced install size. - With native JavaScript improvements, **lodash is now optional** (you can still use it though as it provides powerful utilities). To help with OSS funding, lowdb v2 is released under Parity license for a limited time. It'll be released under MIT license once the goal of 100 [sponsors](https://togithub.com/sponsors/typicode) is reached (currently at 55) or in five months. See [README](https://togithub.com/typicode/lowdb#readme) for complete explanation. You can sponsor me on [GitHub Sponsors](https://togithub.com/sponsors/typicode). Thank you! ##### Migrate ##### Lowdb v1 ```js const low = require('lowdb') const FileSync = require('lowdb/adapters/FileSync') const adapter = new FileSync('db.json') const db = low(adapter) // Set some defaults db.defaults({ posts: [], user: {} }) .write() // Add a post db.get('posts') .push({ id: 1, title: 'lowdb is awesome'}) .write() // Set a user name using Lodash shorthand syntax db.set('user.name', 'typicode') .write() ``` ##### Lowdb v2 ```js import { Low, FileSync } from 'lowdb' const adapter = new FileSync('db.json') const db = new Low(adapter) // Set some defaults db.data ||= { posts: [], user: {} }) db.write() // Add a post db.data .posts .push({ id: 1, title: 'lowdb is awesome'}) db.write() // Set a user name using plain JS db.data.user.name = 'typicode' db.write() ``` **If you're using TypeScript, data can now be typed:** ```ts type Post = { id: number title: string } type Data = { posts: Post[] } const db = new Low(adapter) ``` **To continue using lodash with lowdb:** ```sh npm install lodash ``` ```js import lodash from 'lodash' // Set a user name using Lodash shorthand syntax db.chain = lodash.chain(db.data) db.chain .set('user.name', 'typicode') .value() db.write() ``` ##### Breaking changes The following methods and properties have been removed: - `db.getState` (use `db.data` instead) - `db.setState` (use `db.data = ...` instead) - `db._`Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.