Skip to content

Instantly share code, notes, and snippets.

@bdavidxyz
Created January 9, 2017 15:54
Show Gist options
  • Save bdavidxyz/529d960b711ccd8d059fc61abe9294fc to your computer and use it in GitHub Desktop.
Save bdavidxyz/529d960b711ccd8d059fc61abe9294fc to your computer and use it in GitHub Desktop.
const sizeDifference = _(proposals).size() - _(definedUserAnswers).size(); // 2
const arrayOfFalse = _.times(sizeDifference, _.constant(false)); // [false, false]
return _.chain(definedUserAnswers) // [false, true]
.concat(arrayOfFalse) // [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