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

Question: Comparing Distinct Arrays of Objects

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

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
20/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript
領域
backend

調査の方向性

ファイルまたはテストのエントリポイントは指定されていません。まず、配列パスの評価に関係するルール条件と演算子レジストリを確認してください。提供された2つのfactsの例を使い、同一オブジェクトのマッチングが1つ目ではfalseを返し、2つ目ではtrueを返すことを完了条件として定義してください。

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

説明

Hello,

I am trying to compare an array of objects to check for a specific set of objects to be present in any of them, but not across all of them, specifically lets take this rule:

const arrayRule = {
        conditions: {
            any: [
                {
                    all: [
                        {
                            fact: 'data',
                            path: '$.[*].equalityTest',
                            operator: 'equal',
                            value: 50,
                        },
                        {
                            fact: 'data',
                            path: '$.[*].anotherTest',
                            operator: 'equal',
                            value: 50,
                        },
                    ],
                },
            ],
        },
        event: {
            type: 'arrayRule',
        },
    };

This is the first iteration of the rule I came up with, it is incorrect, but I wanted to give an idea of what I am aiming for.

Specifically here, we have a rule where I want equalityTest to equal 50 and anotherTest to also equal 50. But I want them to equal those values in the same object, such that:
THIS SHOULD RETURN FALSE

 const facts = {
                data: [
                    {
                        anotherIntegerFact: 1,
                        equalityTest: 50,
                    },
                    {
                        anotherIntegerFact: 50,
                        equalityTest: 40,
                    },
                ],
            };

THIS SHOULD RETURN TRUE

 const facts = {
                data: [
                    {
                        anotherIntegerFact: 50,
                        equalityTest: 50,
                    },
                    {
                        anotherIntegerFact: 40,
                        equalityTest: 40,
                    },
                ],
            };

Would love any suggestions or ideas on a way to tackle this. One thought was I could write my own operator and add it to the registry of operators on our end, but before I did so, I wanted to validate that is needed.

Thanks

主要言語
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 を短くまとめたダイジェスト。