sequelize-where

1.0.1 • Public • Published

sequelize-where NPM version Downloads Build Status

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

Dependents (0)

Package Sidebar

Install

npm i sequelize-where

Weekly Downloads

4

Version

1.0.1

License

MIT

Unpacked Size

8.3 kB

Total Files

4

Last publish

Collaborators

  • yocontra