{"id":16027,"library":"feelin","title":"DMN FEEL Parser and Interpreter","description":"Feelin is a robust JavaScript library designed to parse and interpret FEEL (Friendly Enough Expression Language) expressions, a standard defined by DMN (Decision Model and Notation). It provides functions like `evaluate` and `unaryTest` for executing FEEL expressions against a given context. The current stable version is 6.2.0, with minor releases and dependency updates occurring regularly, indicating active maintenance. Key differentiators include its comprehensive recognition of the full FEEL grammar, context-sensitive evaluation (handling names with spaces), built-in FEEL functions, and a focus on error recovery with detailed warnings for issues such as `null` conversions. While not yet fully DMN TCK compliant, it aims for high fidelity to the standard, making it suitable for integrating DMN decision logic into JavaScript applications.","status":"active","version":"6.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/nikku/feelin","tags":["javascript","typescript"],"install":[{"cmd":"npm install feelin","lang":"bash","label":"npm"},{"cmd":"yarn add feelin","lang":"bash","label":"yarn"},{"cmd":"pnpm add feelin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency providing the FEEL language definition for parsing.","package":"lezer-feel","optional":false},{"reason":"Underlying Lezer parser system component.","package":"@lezer/common","optional":false}],"imports":[{"note":"Feelin is an ESM-first package, requiring Node.js >= 20.12.0 for direct usage. Use named imports.","wrong":"const { evaluate } = require('feelin');","symbol":"evaluate","correct":"import { evaluate } from 'feelin';"},{"note":"Both `unaryTest` and `evaluate` are named exports, not default. Ensure correct destructuring.","wrong":"import unaryTest from 'feelin';","symbol":"unaryTest","correct":"import { unaryTest } from 'feelin';"},{"note":"This pattern imports all named exports into a namespace object, useful for accessing multiple utilities without individual destructuring.","wrong":null,"symbol":"*","correct":"import * as feelin from 'feelin';"}],"quickstart":{"code":"import { evaluate, unaryTest } from 'feelin';\n\n// Evaluate a simple expression with a context\nconst result1 = evaluate(\"Mike's daughter.name\", {\n  'Mike\\'s daughter.name': 'Lisa'\n});\nconsole.log('Expression evaluation:', result1.value); // Lisa\n\n// Perform a unary test\nconst result2 = unaryTest('1', { '?': 1 });\nconsole.log('Unary test 1:', result2.value); // true\n\nconst result3 = unaryTest('[1..end]', { '?': 1, end: 10 });\nconsole.log('Unary test 2:', result3.value); // true\n\n// Iterate and transform a list\nconst result4 = evaluate('for a in [1, 2, 3] return a * 2');\nconsole.log('Loop evaluation:', result4.value); // [2, 4, 6]\n\n// Check warnings for undefined variables or null conversions\nconst { value, warnings } = evaluate('x');\nconsole.log('Undefined variable result:', value); // null\nconsole.log('Warnings for undefined variable:', warnings);\n/*\nOutput: [\n  {\n    message: \"Variable 'x' not found\",\n    type: 'NO_VARIABLE_FOUND',\n    position: { from: 0, to: 1 }\n  }\n]\n*/","lang":"typescript","description":"Demonstrates basic usage of `evaluate` and `unaryTest` functions, including context passing, list iteration, and inspecting `warnings` for execution issues like undefined variables."},"warnings":[{"fix":"Always check the `warnings` array in the returned object for detailed error information, especially when `value` is `null`. Adapt any logic that relied on implicit `null` handling to explicitly process these warnings.","message":"Starting with v6.0.0, the package explicitly reports `null` conversion errors in the `warnings` array. Previously, such errors might have been silently handled or returned `null` without explicit warning details. Developers should now inspect the `warnings` property of the result object to understand why a `null` value was produced.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Ensure your Node.js environment meets the minimum requirement of 20.12.0. Update Node.js if necessary.","message":"Feelin requires Node.js version 20.12.0 or higher. Using it with older Node.js versions may lead to compatibility issues, particularly with ESM imports or underlying dependencies.","severity":"gotcha","affected_versions":"<20.12.0"},{"fix":"For Node.js environments, use `import { evaluate } from 'feelin';` in ES module contexts. If you must use CommonJS, consider dynamic `import()` or ensuring your build setup transpiles ESM to CJS.","message":"The package is primarily designed as an ES module (ESM). Attempting to use `require()` for imports in a CommonJS environment without proper transpilation or configuration will result in an error.","severity":"gotcha","affected_versions":"all"},{"fix":"Consult the project's DMN TCK coverage documentation (e.g., `./docs/DMN_TCK.md` in the repository) to understand current limitations and ensure critical DMN expressions function as expected in your specific use case. File issues for observed discrepancies.","message":"While `feelin` recognizes the full FEEL grammar and includes many built-in functions, it is not yet fully compliant with the DMN TCK (Decision Model and Notation Test Compatibility Kit). This means certain complex or edge-case FEEL expressions might behave differently compared to a fully TCK-compliant engine.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Use ES module import syntax: `import { evaluate } from 'feelin';` in your JavaScript/TypeScript files. Ensure your project is configured for ES modules (e.g., `\"type\": \"module\"` in `package.json`).","cause":"Attempting to import `feelin` using CommonJS `require()` syntax in an ES module context or without proper CommonJS fallback/transpilation.","error":"TypeError: require is not a function"},{"fix":"Ensure all variables referenced within your FEEL expression are provided as properties of the context object passed to `evaluate` or `unaryTest`. For example, `evaluate('x', { x: 10 })`.","cause":"An expression references a variable (e.g., 'x') that is not present in the provided context object.","error":"Variable 'x' not found"}],"ecosystem":"npm"}