# dmn-evaluator

> Parses and evaluates dnm diagramms in node or the browser.

Latest version **0.1.0** (published 2020-09-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install dmn-evaluator
pnpm add dmn-evaluator
yarn add dmn-evaluator
bun add dmn-evaluator
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2020-09-07 |
| First published | 2020-09-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 833.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Pablo Maurer |
| Maintainers | maurer-new-media |

## Links

- npm: https://www.npmjs.com/package/dmn-evaluator
- Repository: https://github.com/pablomaurer/dmn-evaluater
- Homepage: https://github.com/pablomaurer/dmn-evaluater#readme
- Issues: https://github.com/pablomaurer/dmn-evaluater/issues
- npm.io page: https://npm.io/package/dmn-evaluator

## Dependencies (2)

- [feelin](https://npm.io/package/feelin.md) ^0.23.0
- [dmn-moddle](https://npm.io/package/dmn-moddle.md) ^9.1.0

## Recent versions

- 0.1.0 (latest) — 2020-09-07

## README

# DMN Evaluator
This is another dmn evaluator.

Mostly took the logic from https://github.com/HBTGmbH/dmn-eval-js but with a different feel interpreter https://github.com/nikku/feelin to avoid having moment.js as a dependency.

## Reasons
- Support for DMN Version 1.3
- Avoid having moment.js as a dep
- More modern setup
- Builds commonJS and ESM for usage with node or browser

## Issues
- Still having no tests, apart from the example-node which has mainly a demonstration purpose
- Parses booleans as strings (performance)
- Using labels as input variables
- Missing configurable logger

## Usage
Look in the example folder

```ts
import { evaluateDecision, parseDmnXml } from 'dmn-evaluater';
import { readFileSync } from 'fs';

// prepare input
const params = {
  age: 29,
  gender: 'm',
  hasGrandchildren: false,
};
const file = '../data/rules1.dmn';
const dmnTable = 'decision_set_1';

// read file and run test function
try {
    const xml = readFileSync(file, 'utf8');
    test(xml, dmnTable, params);
} catch (err) {
    console.error('error reading file at path: ', file, 'err: ', err);
}

// test parser and evaluater
async function test(xml: string, dmnTable: string, params: Object) {
    try {
        const parsedDecisionTable = await parseDmnXml(xml)
        const result = evaluateDecision(dmnTable, parsedDecisionTable, params);
        console.log('result: ', result);
    } catch (err) {
        console.error('error: ', err);
    }

}
```

---
_Source: https://npm.io/package/dmn-evaluator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
