简体   繁体   English

如何访问Ramda.map中的迭代数组?

[英]How can I access iteration array in Ramda.map?

Similar to How can I access iteration index in Ramda.map except I'd like to have access to the array instead. 类似于如何访问Ramda.map中的迭代索引,除了我想改为访问数组。

Array.prototype.map accepts (item, index, arr) => {} . Array.prototype.map接受(item, index, arr) => {} How can I access arr in Ramda.map ? 如何在Ramda.map访问arr

Thanks 谢谢

The linked question quotes the Ramda documentation for addIndex pointing out that it 链接的问题引用了addIndex文档的addIndex指出它

Creates a new list iteration function from an existing one by adding two new parameters to its callback function: the current index, and the entire list. 通过向其回调函数添加两个新参数,从现有函数中创建一个新的列表迭代函数:当前索引和整个列表。

So the entire list is already supplied to your function when you use addIndex . 因此,当您使用addIndex时,整个列表已提供给您的函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM