npm.io
2.2.3 • Published 5d ago

@briza/illogical

Licence
MIT
Version
2.2.3
Deps
0
Size
398 kB
Vulns
0
Weekly
564

illogical Header

illogical

illogical is a JSON DSL (domain-specific language) for expressing and evaluating business rules in the insurance industry. Underwriters use illogical to model business rules for their question sets, enabling distributors to render great user experiences.

build status OpenSSF Scorecard npm version install size zero dependencies npm downloads


Getting Started

Get up and running with illogical in just a few steps.

Installation

# install illogical
npm install @briza/illogical
Basic Usage
// Import the illogical engine
import Engine from '@briza/illogical'

// Create a new instance of the engine
const engine = new Engine()

// Data context
const ctx = {
  name: 'peter',
  age: 21,
  address: {
    city: 'Toronto',
    country: 'Canada',
  },
}

// Evaluate an expression in the given data context
engine.evaluate(['>', '$age', 20], ctx) // true

// Accessing a property
engine.evaluate(['==', '$address.city', 'Toronto'], ctx) // true

// Data Type Casting
engine.evaluate(['==', '$age.(String)', '21'], ctx) // true

// Evaluate a logical expression
engine.evaluate(['AND', ['>', '$age', 20], ['==', '$name', 'peter']]) // true

Documentation

Core Concepts

Explore the supported expressions and their usage:

API Reference

Learn how to use the engine and its methods:

Customization

Customize the engine and the documentation:

Development Tools

For advanced usage like bytecode evaluation and debugging:

Changelog

See changelog.md.

Contributing

See contributing.md.

License

Illogical is released under the MIT license. See license.txt for details.

Keywords