parse and stringify RESTFull filter string
npm install filter-string





Parse and stringify RESTFul filter string
``bash`
npm install filter-string
`javascript
import { stringify } from 'filter-string'
const filters = [
{
key: 'a',
op: 'eq',
value: 'xxx',
},
{
key: 'b',
op: 'gt',
value: 'yyy',
},
]
const $filter = stringify(filters, {
op: 'and',
})
// output
// a eq xxx and b gt yyy
`
`javascript
import { parse } from 'filter-string'
const $filter = 'a eq xxx and b gt yyy'
const filters = parse($filter)
// output
// [{
// key: 'a',
// op: 'eq',
// value: 'xxx'
// }, {
// key: 'b',
// op: 'gt',
// value: 'yyy'
// }]
`
`javascript`
Array.prototype.filter
`javascript`
Array.prototype.find
> FYI: You should add polyfill by yourself if need
- Installation
`bash`
npm install
- Build for publish
`bash`
npm run build
- Run test
`bash``
npm run test