-
3 votesanswersviews
这个Ramda.js数据转换可以改进吗?
我有一个商店列表和一个id列表: var stores = [{id: '1', name: 'first store'}, {id: '2', name: 'second store'}, {id: '3', name: 'third store'}]; var ids = ['1', '2']; 我想获取与列表中的ID匹配的商店名称: ["first store", &q... -
2 votesanswersviews
拉姆达能改善这个吗? [关闭]
我正在发现Ramda库并试图围绕函数式编程 . 我想知道是否有更简洁的方法使用Ramda实现这样的函数: const replace = (template, dict) => Object.keys(dict).reduce( (template, key) => template.replace(key, dict[key]), template ); 我... -
0 votesanswersviews
Ramdajs:如何基于对象的嵌套属性进行过滤
const abby = {name: 'Abby', attributes: {age: 7, hair: 'blond'}}; const fred = {name: 'Fred', attributes: {age: 12, hair: 'brown'}}; const rusty = {name: 'Rusty', attributes: {age: 10, hair: 'brown'}}... -
2 votesanswersviews
在每个函数接收相同值的Ramda中编写函数
如果我想编写一系列函数,我可以使用 compose ,这将允许我定义一系列函数,一个或多个参数传递给第一个,然后返回第一个传递给第二个的值和传递给第三个的第二个返回值,依此类推...... compose(f3, f2, f1)(value); 这相当于: f3(f2(f1(value))) 但是,如果我想用 value 调用所有三个函数怎么办? 我的用例是我有一系列功能来验证一段数据 . 在...