Skip to content

Instantly share code, notes, and snippets.

@lovubuntu
Created October 24, 2018 17:40
Show Gist options
  • Save lovubuntu/b5294b0c6ef182cf84dcf7f72a0e1b53 to your computer and use it in GitHub Desktop.
Save lovubuntu/b5294b0c6ef182cf84dcf7f72a0e1b53 to your computer and use it in GitHub Desktop.
First try with lodash
let _ = require('lodash');
const unionList = _.unionWith(oldSelectedList, newlySelectedList, (o, n) => o.id === n.id);
const finalList = _.intersectionWith(unionList, newlySelectedList, (u, n) => u.id === n.id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment