Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

allowUndefinedFacts not working when the facts type are string

オープン
#270 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript
領域
backend

調査の方向性

まず、Engine.run、空の facts オブジェクト、allowUndefinedFacts を有効にした状態で、提供された再現手順を実行します。次に、notEqual 演算子が undefined の fact Astring と数値の fact Bnumber をどのように処理するかを追跡します。両方の fact 型に対してオプションが一貫して動作し、再現手順がドキュメントに記載された期待される結果を生成すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Here's my example, you can reproduce the issue with the code:
const customAttributeRule = { "name": "allowUndefinedFacts-test", "attributes": [ { "name": "Astring", "type": "string" }, { "name": "Bnumber", "type": "number" } ], "decisions": [ { "conditions": { "all": [ { "fact": "Astring", "operator": "notEqual", "value": "string" } ] }, "event": { "type": "Astring", "params": { "value": "1", "description": "Astring test" } } }, { "conditions": { "all": [ { "fact": "Bnumber", "operator": "lessThan", "value": 5 } ] }, "event": { "type": "Bnumber", "params": { "value": "1", "description": "Bnumber test" } } } ] }
let facts = {}
const engine = new Engine(customAttributeRule.decisions, {allowUndefinedFacts: true}); engine.on('success', event => { console.log(event) });
let result = engine .run(facts)
The engine output is
{ type: 'Astring', params: { value: '1', description: 'Astring test' } }
However, the allowUndefinedFacts works when then fact type is number

Since the engine treat undefined facts as undefined, so I added another condition that { "fact": "Astring", "operator": "notEqual", "value": "undefined" }, but it still does not work as expected

主要言語
JavaScript
スター
3.1k
フォーク
507
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

CacheControl/json-rules-engine のほかの issue

CacheControl/json-rules-engine の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。