Skip to content

Instantly share code, notes, and snippets.

@yuripramos
Created December 2, 2021 11:41
Show Gist options
  • Save yuripramos/2d492500c0322706b2cf873485e7776a to your computer and use it in GitHub Desktop.
Save yuripramos/2d492500c0322706b2cf873485e7776a to your computer and use it in GitHub Desktop.
Intersection
const tokens = ['USDC', 'USDT', 'ETH'];
const contracts = [{contract:"#CAS#", tokens: ["BTC"]},{contract: "FSA@#", tokens:["ETH","USF"]},{contract: "8%SD8", tokens:["ETH" ]}]
const intersection = contracts.filter(contract => tokens.some(token => {
return contract.tokens.includes(token)
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment