CacheControl / CacheControl/json-rules-engine
How to handle array of objects?
- 主要語言
- JavaScript
- 星號
- 3.1k
- 分支
- 507
- PR 合併指標
- 30 天內沒有已合併 PR
描述
Usecase: Is there any equipment with type embroidery and setting speed 250?
Fact:
```
const facts = {
equipmentList: [
{ type: 'embroidery', setting: { speed: 250 } },
{ type: 'sewing', setting: { speed: 150 } },
],
substrate: { color: { hexcode: '#FFFFFF' } },
Size: 'S',
};
```
// the following IS NOT working as expected. no matter what 'setting.speed' I give, I am getting true for the condition
```
{
"all": [
{
"fact": "equipmentList",
"path": "$[?(@.type == 'sewing' && @.setting.speed == 250)]",
"operator": "notEqual",
"value": []
},
]
}
```
Does the package support this kind of a usecase?
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
首先,針對 issue 中顯示的 equipmentList facts 重現該規則,包括 JSONPath 篩選器和 notEqual 比較。檢查 package 是否支援比對陣列中的巢狀物件,以及結果是否應識別出 speed 為 250 的 embroidery。當文件化的使用案例依預期運作,或限制已明確確立時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- javascript
- 領域
- backend
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100