underscore-query
underscore-query copied to clipboard
Make it pluggable to lowdb
Hello, first of all i have to say this is an awesome library.
I've tried to augment lowdb with this mixin lib. Unfortunately without success.
import low from 'lowdb'
const db = low('db')
// `underscore-query` doesn't expose an object of mixins
db._.mixin({
second: function(array) {
return array[1]
}
})
I usually use native js methods for data manipulation but it seems i'll have to create my first SPA application soon and these two libraries would play awesome together so i can easiely manipulate state and persist it to localstorage or even indexed db with a custom lowdb storage adapter.
I short quote from lowdb's readme:
Database lodash instance. Use it to add your own utility functions or third-party mixins like underscore-contrib or underscore-db.
ping @davidgtonge @megawac @typicode
Hi all,
Based on the README, I think it should be possible to do the following:
const low = require('lowdb')
const underscoreQuery = require('underscore-query')
const db = low()
// Add query to the db lodash instance
underscoreQuery(db._)