Skip to content
/ feelin Public

A DMN FEEL parser and interpreter written in JavaScript

License

Notifications You must be signed in to change notification settings

nikku/feelin

Repository files navigation

feelin

CI

A DMN FEEL parser and interpreter written in JavaScript. ➡️ Try it out.

Usage

import {
  unaryTest,
  evaluate
} from 'feelin';

unaryTest('1', { '?': 1 }); // { value: true, warnings: [] }
unaryTest('[1..end]', { '?': 1, end: 10 }); // { value: true, warnings: [] }

evaluate("Mike's daughter.name", {
  'Mike\'s daughter.name': 'Lisa'
}); // { value: 'Lisa', warnings: [] }

evaluate('for a in [1, 2, 3] return a * 2'); // { value: [ 2, 4, 6 ], ... }

evaluate('every rate in rates() satisfies rate < 10', {
  rates() {
    return [ 10, 20 ];
  }
}); // { value: false, warnings: [] }

To understand null conversions due to errors, inspect warnings returned:

const { value, warnings } = evaluate('x');

console.log(warnings);
// [
//   {
//     message: "Variable 'x' not found",
//     type: 'NO_VARIABLE_FOUND',
//     position: { from: 0, to: 1 },
//   }
// ]

Features

  • Recognizes full FEEL grammar
  • Context sensitive (incl. names with spaces)
  • Recovers on errors
  • Temporal types and operations
  • Built-in FEEL functions
  • Full DMN TCK compliance (cf. coverage)

Build and Run

# build the library and run all tests
npm run all

# spin up for local development
npm run dev

# execute FEEL tests in DMN TCK
npm run tck

Related

License

MIT

About

A DMN FEEL parser and interpreter written in JavaScript

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Contributors 8