我正在尝试将这个函数重构为无意义的。
function siblings(me) {
return R.pipe(family, R.reject(equalsMe(me)))(me);
}
我想通过me
到管道中的函数以及值family
返回。
尝试了一些事情R.useWith
or R.converge
with R.identity
or R.__
(甚至不确定我是否应该使用它)但发现没有任何作用。
我还建议使用R.converge
和交换R.reject(equalsMe(me))
with R.without(me)
const withFamily = R.always(['fratello', 'sorella', 'io']);
const siblingsOf = R.converge(R.without, [
R.identity,
withFamily,
]);
console.log(
siblingsOf('io'),
);
console.log(
siblingsOf('sorella'),
);
<script src="https://cdnjs.cloudflare.com/ajax/libs/ramda/0.27.1/ramda.js" integrity="sha512-3sdB9mAxNh2MIo6YkY05uY1qjkywAlDfCf5u1cSotv6k9CZUSyHVf4BJSpTYgla+YHLaHG8LUpqV7MHctlYzlw==" crossorigin="anonymous"></script>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)