Question: Comparing Distinct Arrays of Objects
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 20/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- backend
Direzione di ricerca
Non è indicato alcun punto di ingresso di file o test. Inizia esaminando la condizione della regola e il registro degli operatori relativo alla valutazione dei percorsi di array; usa i due esempi di facts forniti per definire il completamento come una corrispondenza dello stesso oggetto che restituisce false per il primo e true per il secondo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- JavaScript
- Stelle
- 3.1k
- Fork
- 507
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di CacheControl/json-rules-engine
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
CacheControl/json-rules-engine#427 · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
CacheControl/json-rules-engine#424 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
CacheControl/json-rules-engine#421 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
CacheControl/json-rules-engine#417 · 1 reazione ·
Tutte le issue di CacheControl/json-rules-engine
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Theme loads third-party resources on every page (jsdelivr web font, cdnjs Font Awesome) – GDPR Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
docToolchain/docToolchain#1705 ·
-
Timezone select lists one option per character; duplicate "Failed" reason; shared tracker popover id Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
nightscout/nocturne#1414 ·
-
bug v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
modelcontextprotocol/inspector#2458 · 1 commento ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
carbon-design-system/ibm-products#9907 ·