0.1.4 • Published 5 years ago

predicate-ts v0.1.4

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

predicate-ts

Build Status

a predicate library for Typescript

Installation

npm install predicate-ts --save

Usage example

import {Predicate} from 'predicate-ts'

// `AND`  example
const gt10 = Predicate.build<number>(n => n > 10);
const lt20 = Predicate.build<number>(n => n < 20);

gt10.and(lt20).test(15) // -> true
gt10.and(lt20).test(0) // -> false

// `OR` example
const lt10 = Predicate.build<number>(n => n < 10);
const gt20 = Predicate.build<number>(n => n > 20);

lt10.or(gt20).test(15) // -> false
lt10.or(gt20).test(0) // -> true
lt10.or(gt20).test(30) // -> true

// `NOT` example
lt10.or(lt20.negate()).test(15) // -> false
lt10.or(lt20.negate()).test(0) // -> true
lt10.or(lt20.negate()).test(30) // -> true

Development setup

npm install
npm test

Release History

  • 0.1.0
    • still under development

Meta

Distributed under the MIT license. See LICENSE for more information.

Contributing

  1. Fork it (https://github.com/trinin/predicate-ts/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request
0.1.4

5 years ago

0.1.3

5 years ago