如何检查某些对象值是否与 Ramda 中的谓词匹配?
How to check if some of the object values match the predicate in Ramda?
既然没有R.some
,我该如何在Ramda中实现以下呢?
const hasKey = (predicate, object) =>
Object.keys(object)
.map(key => object[key])
.some(predicate);
Since there is no R.some
…
它被称为 any
。
how do I implement the following in Ramda?
你会写
const hasKey = (p, o) => R.any(p, R.values(o))
既然没有R.some
,我该如何在Ramda中实现以下呢?
const hasKey = (predicate, object) =>
Object.keys(object)
.map(key => object[key])
.some(predicate);
Since there is no
R.some
…
它被称为 any
。
how do I implement the following in Ramda?
你会写
const hasKey = (p, o) => R.any(p, R.values(o))