2.0.0 • Published 2 years ago

knight-criteria-matcher v2.0.0

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

Knight Criteria Matcher by Coderitter

Determines if an object matches given criteria.

Related packages

This packages uses criteria from knight-criteria and matches them against an JavaScript object.

There is an in-memory object database knight-object-db which uses criteria and the matcher of this package to be able to query objects in that database.

Install

npm install knight-criteria-matcher

Overview

matchCriteria()

import { matchCriteria } from 'knight-criteria-matcher'
import { Criteria } from 'knight-criteria'

let obj = {
    name: 'Fatlinda'
}

let criteria: Criteria = {
    name: {
        operator: 'LIKE',
        value: '%linda%'
    }
}

matchCriteria(obj, criteria) == true