Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 707 Bytes

no-extraneous-args.md

File metadata and controls

21 lines (15 loc) · 707 Bytes

No extraneous arguments to methods with a fixed arity

In lodash/fp, most methods have a fixed number of arguments, often ignoring optional arguments available in vanilla Lodash. For instance, in vanilla Lodash, _.get accepts a third parameter that serves as the default value, which gets ignored in lodash/fp (hint: use the _.getOr method instead which exists for that purpose). The rule reports instances where too many arguments are passed to a method.

Fail

_.get(path, defaultValue, object);
_.find(iteratee, object, extraneous);

Pass

_.get(path, object);
_.getOr(path, defaultValue, object);
_.find(iteratee, object);