简体   繁体   中英

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.

Array.prototype.map accepts (item, index, arr) => {} . How can I access arr in Ramda.map ?

Thanks

The linked question quotes the Ramda documentation for addIndex pointing out that it

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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