Netherworld's Pretend Minibar

    compar
    TypeScript icon, indicating that this package has built-in type declarations

    6.0.0 • Public • Published

    Compar

    Extensible declarative rule matching engine

    Compar provides an easy way to decouple rules from code, and it is ideal for creating custom engines for experiments, feature flags, tutorials, etc. Compar is written in TypeScript and it runs in the browser, or on the server using node.js.

    Setup

    yarn add compar

    or

    npm install --save compar

    Usage

    Before you start import the library

    import { create } from 'compar'

    Basic usage

    const match = create()
    
    match(
      {
        environment: 'stage',
        userId: '45654800-7a3a-4273-b1cb-4eace4086cce'
      },
      [
        '&',
        ['.', 'environment', ['|', ['=', 'stage'], ['=', 'production']]],
        [
          '.',
          'userId',
          [
            '|',
            ['=', '45654800-7a3a-4273-b1cb-4eace4086cce'],
            ['=', '5137c85d-a4d0-4d6c-8d85-0a74a24007c8']
          ]
        ]
      ]
    )

    License

    MIT

    Install

    npm i compar

    DownloadsWeekly Downloads

    0

    Version

    6.0.0

    License

    MIT

    Unpacked Size

    10.6 kB

    Total Files

    9

    Last publish

    Collaborators

    • claudiuandrei