0.3.0 • Published 9 months ago

@criterium/core v0.3.0

Weekly downloads
-
License
ISC
Repository
github
Last release
9 months ago

@criterium/core

an agnostic helper to create mongo-like filter.

install

npm i @criterium/core

usage

import { converter } from '@criterium/core';

const where = converter({
  operators: {
    $and: (_, __, children) => children.join(' '),
    $eq: ([prop], value) => `${prop} = "${value}"`,
    ...
  }
})

where({
  name: 'John'
})
// name = "John"