Skip to content

Latest commit

 

History

History
54 lines (42 loc) · 902 Bytes

README.md

File metadata and controls

54 lines (42 loc) · 902 Bytes

objection-find-query

Build Status

Construct complex api query on the frontend, for endpoints implementing objection-find.

Usage:

/*
  expected format:
  {
    op: {
      column: value
    }
  }

  sample input:
  {
    gt: {
      released: 1953,
      gross_income: 200000,
      actors: {
        age: 23
      }
    },
    lt: {
      released: 1984
    },
    in: {
      ratings: [3, 4]
    }
  }

  output:
  {
    'released:gt': 1953,
    'gross_income:gt': 200000,
    'actors.age:gt': 23,
    'released:lt': 1984,
    'ratings:in': [3, 4]
  }
*/

const ofq = require('objection-find-query');
const formattedParams = ofq.format(params);

Installation

npm install objection-find-query