0.2.2 • Published 2 years ago

@criteria/predicates v0.2.2

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

Predicates

Define logical conditions to test an input value.

Installation

npm install @criteria/predicates

Usage

Create a predicate from a string:

import { Predicate } from '@criteria/predicates'

const predicate = Predicate.parse('name = $searchTerm')

Test an input value:

const person = {
    name: "Joe"
}

const output = predicate.evaluate(person, { searchTerm: "Joe" })
// output === true

Serialize a predicate to a string:

const string = predicate.toString()
0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago