Inclue RHS factResult after condition evaluation

Open
#279 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
backend

Research direction

Start with src/rule.js around lines 207-212 and compare its behavior with examples/08-fact-comparison.js. Trace how condition evaluation builds the rule result, then verify that a right-hand-side factResult is included alongside the existing left-hand-side result.

Written by the indexing model from the issue text.

Description

We are using the functionality to allow the LHS attribute to be compared to a RHS attribute (demonstrated in this example) but noticed that in the rule result, only the LHS factResult is included. Would it be possible to also include the RHS factResult? I am not too familiar with the code but it seems like the logic is contained below

https://github.com/CacheControl/json-rules-engine/blob/90272d61ed7bea8b7d4000305511e932490d2e2e/src/rule.js#L207-L212

and a logic statement along the lines of
if (condition.value is an object) condition.value.factResult = evaluationResult.rightHandSideValue
could be added?

If there are no issues with this I am happy to open a PR

Dominant language
JavaScript
Stars
3.1k
Forks
507
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from CacheControl/json-rules-engine

All issues in CacheControl/json-rules-engine

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.