These are chat archives for ramda/ramda
arityare very similar. They both wrap your function in one of length
nAryonly passes along
aritypasses along as many as you supply.
nAryis especially useful for when you want to restrict a function that accepts optional parameters to instead ignore them. Think of the
parseIntbeing entangled with the
indexparameter supplied by
Array.prototype.map-- one good exaple of the reason we don't supply such a parameter in
R.map-- which could be overcome with
['1', '2', '3'].map(nAry(1, parseInt))(obviously, not the easiest fix for the issue!).
arity, on the other hand, simply makes it easier to report the length properly, even though the function might use the
argumentsobject rather than named parameters. It expecially helps with currying functions that don't have a specified length, although you don't have to call it directly there, since
curryNcalls it for you.