Skip to content

Instantly share code, notes, and snippets.

@bdavidxyz
Last active December 31, 2016 09:49
Show Gist options
  • Save bdavidxyz/5ea94ea13eff0da105c0d434ca7ebae1 to your computer and use it in GitHub Desktop.
Save bdavidxyz/5ea94ea13eff0da105c0d434ca7ebae1 to your computer and use it in GitHub Desktop.
const sizeDifference = _(proposals).size() - _(userAnswers).size(); // 2
const completeWithFalse = _.times(sizeDifference, _.constant(false)); // [false, false]
return _.chain(userAnswers) // [false, true]
.concat(completeWithFalse) // [false, true, false, false]
.zip(proposals) // [[false, 'prop 1'], [true, 'prop 2'], [false, 'prop 3'], [false, 'prop 4']]
.map(_.reverse) // [['prop 1', false], ['prop 2', true], ['prop 3', false], ['prop 4', false]]
.value();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment