Functional Programming with Lodash FP
Lodash FP is an alternative to Lodash that favors functional programming (FP) practices.
import fp from 'lodash/fp';
const double = fp.map(x => x * 2);
double([1, 2, 3]);
// => [2, 4, 6]
const getNames = fp.map('name');
getNames([{ name: 'john' }, { name: 'jane' }]);
// => ['john', 'jane']
const transform = fp.flow(
fp.map(x => x * 2),
fp.filter(x => x > 5)
);
transform([1, 2, 3, 4]);
// => [6, 8]
Lodash FP can lead to more predictable and easier to reason about code in functional programming paradigms.
Previous: ES6 and Lodash Next: Custom Builds
Last updated 4 days ago