bloomtime/boolean-expression-js

Name: boolean-expression-js

Owner: Bloom

Description: A javascript/node.js library for compiling and evaluating boolean search terms, using ReParse.

Created: 2011-10-10 16:17:44.0

Updated: 2017-07-20 15:35:16.0

Pushed: 2012-07-11 22:54:15.0

Homepage: https://github.com/bloomtime/boolean-expression-js

Size: 112

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Uses https://github.com/weaver/ReParse

Compiles and evaluates simple boolean search expressions, e.g.

parsed = new Expression("John AND Paul AND Ringo AND George");
rt.equal(parsed.test("John"), false);
rt.equal(parsed.test("Paul"), false);
rt.equal(parsed.test("Ringo"), false);
rt.equal(parsed.test("George"), false);
rt.equal(parsed.test("John Paul George Ringo"), true);
rt.equal(parsed.test("Ringo George Paul John"), true);

Supports parens for disambiguation. Supports AND, OR and NOT. Supports quotes for phrases. Case insensitive.

See tests for more examples.

TODO:


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.