Skip to content

Instantly share code, notes, and snippets.

@yuripramos
Created December 2, 2021 11:41
Show Gist options
  • Select an option

  • Save yuripramos/2d492500c0322706b2cf873485e7776a to your computer and use it in GitHub Desktop.

Select an option

Save yuripramos/2d492500c0322706b2cf873485e7776a to your computer and use it in GitHub Desktop.

Revisions

  1. yuripramos created this gist Dec 2, 2021.
    7 changes: 7 additions & 0 deletions intersection.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    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)
    }))