Created
October 24, 2018 17:41
-
-
Save lovubuntu/c76f82c5c78c8cb139fd902ed52f692c to your computer and use it in GitHub Desktop.
Using method chaining in lodash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let _ = require('lodash'); | |
const finalList = _.chain(oldSelectedList) | |
.unionWith(newlySelectedList, (o, n) => o.id === n.id) | |
.intersectionWith(newlySelectedList, (u, n) => u.id === n.id) | |
.value(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment