0
我想知道如何查看一個特定的值,在這種情況下「/ db/User/10」是否存在於一組對象中從API返回。如何測試值是否存在於Ramda對象集
將數據從API返回的執行console.log(測試)
Set {
Object {
"UserData": "/db/UserData/509c404f-ffa1-49d3-a161-b9eb5b2ebb14",
"UserDataPrivate": "/db/UserDataPrivate/26b7d879-4403-4135-ab44-b23e5244606b",
"UserStatus": "/db/UserStatus/cb50eae0-e254-4d8c-915a-674fd314fff3",
"createdAt": "2017-10-20T21:03:26.575Z",
"id": "/db/User/68",
"inactive": null,
"updatedAt": "2017-10-20T23:34:12.179Z",
"username": "15031111234",
"version": 4,
},
Object {
"UserData": "/db/UserData/a3dded63-4e0b-4841-b201-4c96dad1844d",
"UserDataPrivate": "/db/UserDataPrivate/6037a718-e33f-4945-b2d0-ca4c11fa4f13",
"UserStatus": null,
"createdAt": "2017-09-21T18:26:31.089Z",
"id": "/db/User/10",
"inactive": false,
"updatedAt": "2017-10-18T20:10:06.681Z",
"username": "15038304313",
"version": 19,
},
}
var searchbyID = propEq('id', '/db/User/10');
result = filter(searchbyID, test);
console.log(result)
我想這應該返回true,而是,它返回一個空數組。
這是拉姆達的正確方法嗎?