I personally prefer the following - although this is more detailed, because I think it is more obvious what he is doing. This requires the es6 syntax:
_.toPairs(foo) .filter([key, value] => value) .map([key, value] => key);
If your ESLint does not allow the use of unused variables, you can, for example, use the following in .eslint.yml :
rules: no-unused-vars: - 2 - vars: all args: after-used argsIgnorePattern: _$
What allows you to write
_.toPairs(foo) .filter([key_, value] => value) .map([key, value_] => key);
Vincent van der weele
source share