@briza/illogical

中文文档
3.0.0发布于 2026/09/29MITTypeScriptESM + CJS零依赖近 30 天下载 4246

A micro conditional javascript engine used to parse the raw logical and comparison expressions, evaluate the expression in the given data context, and provide access to a text form of the given expressions.

原始使用文档
文档目录12 节
  1. illogical
  2. 🚀 Getting Started
  3. Installation
  4. Basic Usage
  5. 📚 Documentation
  6. Background
  7. Core Concepts
  8. API Reference
  9. Customization
  10. 📖 Changelog
  11. 🤝 Contributing
  12. 📜 License

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.

Read the Background section to quickly understand what illogical is and why it exists.

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

Background

illogical is a JSON DSL (domain-specific language) for expressing and evaluating business rules in the insurance industry.

Domain-specific languages exist to streamline work in a given domain by providing the means of performing tasks in a way that is quicker to learn and implement. This lets you optimize your custom solution and tailor it for use by distinct user groups or within unique contexts.

Developers of software for insurance underwriters can enable illogical quickly and easily to make the underwriter's task of writing question sets for programmatic use more efficient by eliminating the need to learn and understand the programming language(s) in use.

The way it works is that underwriters use the illogical JSON DSL to express their underwriting models, specifically their question sets and business rules. Then, the JavaScript functions in illogical parse what has been written for use within an application.

Another way to think about this is that illogical is used to define machine-readable business rules for underwriting models and question sets that brokers and distribution partners can easily consume. This is much more efficient than the traditional use of spreadsheets, documents, PDFs, email exchanges, and other non-machine-readable formats that then must be translated before being used. illogical speeds up the integration process, gets your rules to market faster, and does so with significantly reduced submission errors and a lower total cost of ownership.

Core Concepts

Explore the supported expressions and their usage:

API Reference

Learn how to use the engine and its methods:

Customization

Customize the engine options.

📖 Changelog

See changelog.md.

🤝 Contributing

See contributing.md.

📜 License

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

版本与发布记录

@briza/illogical 共发布 49 个版本,首次发布于 2019/10/16;过去 12 个月发布了 13 个版本。

版本发布日期距今
3.0.0latest2026/09/291 个月前
2.2.52026/09/161 个月前
2.2.42026/09/091 个月前
2.2.32026/06/244 个月前
2.2.22026/06/104 个月前
2.2.12026/06/025 个月前

关于 @briza/illogical 的常见问题

@briza/illogical 是什么?

A micro conditional javascript engine used to parse the raw logical and comparison expressions, evaluate the expression in the given data context, and provide access to a text form of the given expressions.

如何安装 @briza/illogical?

在项目目录运行 npm install @briza/illogical,或使用 pnpm add / yarn add / bun add。

@briza/illogical 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@briza/illogical 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@briza/illogical 可以商用吗?

@briza/illogical 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@briza/illogical 的下载量有多少?

根据 npm 官方下载统计,@briza/illogical 在 2026/10/09 – 2026/11/07 这 30 天内被下载 4,246 次,日均约 142 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@briza/illogical 还在维护吗?

最新版本 3.0.0 发布于 2026/09/29(1 个月前);至今共发布 49 个版本,其中过去 12 个月发布了 13 个;首次发布于 2019/10/16。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。