Is it still possible to get the value in lodash?
I can't..
import { join, dirname } from 'path'
import { Low, JSONFile } from 'lowdb'
import { fileURLToPath } from 'url'
import lodash from 'lodash'
const __dirname = dirname(fileURLToPath(import.meta.url));
// Use JSON file for storage
const file = join(__dirname, 'db.json')
const adapter = new JSONFile(file)
const db = new Low(adapter)
// ...
// Note: db.data needs to be initialized before lodash.chain is called.
db.chain = lodash.chain(db.data)
// Instead of db.data, you can now use db.chain if you want to use the powerful API that lodash provides
const post = db.chain
.get('posts')
.find({ id: 1 })
.value() // Important: value() needs to be called to execute chain
console.log(post)
console.log(db.chain
.get('posts'))
db.json
{
"posts": [
{"id": 1, "title":"lowdb is awesome"}
]
}
Is it still possible to get the value in lodash? I can't..
db.json
result