Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Blog - Achieving point-free JavaScript - lodash refactored
import {pipe, pluck, over, head, last, spread} from 'lodash/fp';
import {daysSpent} from './utils/dates';
// leadTime : [{date: Date}] -> Number
const leadTime = pipe(
pluck( 'date' ), // first convert input into [Date]
over( [ head, last ] ), // then turns them to our arguments array [ FirstDate, LastDate ]
spread( daysSpent ) // finally spread arguments to the function
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.