markdown Ramda Prop和PropOr
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Ramda Prop和PropOr相关的知识,希望对你有一定的参考价值。
**Intermediate Example:**
Removes Edges from an object
<pre><code>
const data = {
"person": {
"id": "\/people\/4",
"name": "LottyHinde",
"hours": {
"edges": [
{
"node": {
"id": "\/hours\/1",
"number": 8
}
},
{
"node": {
"id": "\/hours\/2",
"number": 7
}
}
]
}
}
};
const reformatedHours = R.propOr([],'edges',data.person.hours,); //Removes Edges from an object [{"node":{"id":"/hours/1","number":8}},{"node":{"id":"/hours/2","number":7}}]
</code></pre>
以上是关于markdown Ramda Prop和PropOr的主要内容,如果未能解决你的问题,请参考以下文章
markdown Ramda map和mapObjIndexed
打字稿:如何键入 Ramda R.prop(key) T' 不可分配给类型为 '(s: ) => 的参数
[Ramda] Pluck & Props: Get the prop(s) from object array
[Ramda] Compose and Curry
markdown Ramda Pluck
markdown 使用ramda按嵌套值过滤对象数组