@criteria/predicates
TypeScript icon, indicating that this package has built-in type declarations

0.2.2 • Public • Published

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()

Readme

Keywords

Package Sidebar

Install

npm i @criteria/predicates

Weekly Downloads

14

Version

0.2.2

License

MIT

Unpacked Size

312 kB

Total Files

73

Last publish

Collaborators

  • jamesmoschou-criteria