Is there a way to indicate un-needed parameters in arrow function arguments (and during destructuring as well)?
Contrived case in point where I am using _
to indicate un-need parameters in my arrow function:
import _ from 'lodash';
const m = [];
m.push({k: 1, v: 'a'});
m.push({k: 2, v: 'b'});
m.push({k: 3, v: 'c'});
const bExists = _.filter(m, ( {_,v}, _1, _2)=>{
return v==='b';
}).length > 0;
Two gripes with the above code:
_
(used in languages like F#) is the same as the lodash import. Not a syntax error but still confusingsubsequent
_
have to be renamed as_1
,_2
otherwise one gets:SyntaxError: es6/app.js: Argument name clash in strict mode
I could simply omit the _1
and _2
arguments but only because in this particular example the unneeded ones appear at the end of the argument list.
The first of the above gripes can obviously be solved by using some other name, yet the second one still stands (and whatever name is adopted as a convention would have to be mangled in subsequent unneeded arguments).
So, is there language support to indicate unused parameters in arrow functions or (failing that) established conventions on that?