What's the significance of calling void
before returning in ramda's arity function?
Asked
Active
Viewed 81 times
0
-
Perhaps it actually removes the last argument? I do notice that it takes a parameter `n` that would not be desired to pass to the closure when passing `arguments`. – Demonslay335 Nov 05 '14 at 12:09
2 Answers
1
To just make sure no weird errors/warnings are popping up, as far as I know. If by any change the variable is made elsewhere with values. void makes it empty.

HarrieDakpan
- 90
- 8
-
Void doesn't alter the value of a variable, it just "[evaluates the given _expression_ and then returns `undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void)". For example `(function (a) { void a; return a; })(123);` returns `123`, not `undefined`. – c24w Nov 07 '14 at 09:45
1
ramda co-author here. That is an artifact of some of the code linting we do. We want to be warned if there are ununsed parameters in a function definition. In the case of arity
, the params are only there to create a function with the correct, well, arity. Adding the void arg_n
passes the linter.

Buzz de Cafe
- 61
- 2
-
Thanks for the answer. I assumed it would be for something like linting after someone mentioned warnings in a comment (which was then deleted). – c24w Nov 15 '14 at 10:56