sequelize-where
v1.0.1
Published
Pure JS implementation of the sequelize query language (where)
Downloads
34
Maintainers
Readme
sequelize-where
Simple query language for filtering objects. Pure JS implementation of the where
part of queries from Sequelize.
Install
npm install sequelize-where --save
Usage
import filter from 'sequelize-where'
// filter takes a query object and returns a function
// the filter function returned takes one object argument - the input data
const fn = filter({
$or: [
{ a: 'c' },
{ a: 'd' },
{ b: { $in: [ 'd', 'e', 'f' ] } }
]
})
console.log(fn({ a: 'c' })) // true
console.log(fn({ a: 'd' })) // true
console.log(fn({ a: 'f' })) // false
console.log(fn({ a: 'f', b: 'e' })) // true