如何使用Ramda通过键值在Array中查找匹配的对象 [英] How to use Ramda to find matching object in Array by key value
本文介绍了如何使用Ramda通过键值在Array中查找匹配的对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当前,这给了我 undefined ,但是 R.propEq 应该会在我认为的 Currently this is giving me undefined, however R.propEq should find the matching object by key 正如您所说,可以通过将密钥传递给 As you say, you can solve it by passing in the key to 另一种选择是使用 Another option is to use the 您可以看到 第二 版本. You can see the first or second version in the Ramda REPL. 这篇关于如何使用Ramda通过键值在Array中查找匹配的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!port
中通过键ticker
找到匹配的对象?ticker
in port
I thought?推荐答案
propEq
:propEq
:R.find(R.propEq('ticker', 'aa'), port)
eqProps
函数,该函数测试两个对象是否匹配命名密钥:eqProps
function, which tests if two objects match for the named key:R.find(R.eqProps('ticker', ticker), port)
查看全文