Home Manual Reference Source Test Repository

js-criteria

A criteria library on json , javascript map object.

Build Status Docs Coverage codecov

Motivation

Aims to be a complete solution for query on json and javascript map objects. All coded with ES6 syntax.

What's inside

Quick Start

Install and Usage

Go to your project folder

npm install js-criteria --save

You can import this project in 2 ways.

  1. Partial import. For ex. import Criteria from "js-criteria/lib/api/Criteria";
  2. All-in-one, minified, optimized single js. For ex. TODO: example coming soon.

  3. see api detail for usage

  4. Example Data
    [
        {
            id: "1",
            name: "Luffy",
            surname: "Monkey D."
        },
        {
            id: "2",
            name: "Zoro",
            surname: "Roronoa"
        },
        {
            id: "3",
            name: "Nami",
            surname: ""
        },
    ];
    const criteria = new Criteria(dataList);
  criteria.add(Restrictions.like("name", "%a%"));
  criteria.add(Restrictions.gt("id", 1));
    criteria.setMaxResults(3);
    criteria.setMaxResults(3);
    const list = criteria.list();

How to contribute

Clone and run npm install. This will install both run-time project dependencies and developer tools listed in package.json file.

How to Build for Production

If you need just to build the app (without running a dev server), simply run:

$ npm run-script build

How to run Unit Tests.

$ npm test