Skip to content

Instantly share code, notes, and snippets.

@macklinu
Created January 21, 2020 18:31
Show Gist options
  • Save macklinu/0b8849bbd48be572fc6ae5f41927c8c1 to your computer and use it in GitHub Desktop.
Save macklinu/0b8849bbd48be572fc6ae5f41927c8c1 to your computer and use it in GitHub Desktop.
const isNbaBasketball = matches({
type: 'basketball',
ballColor: 'orange',
ballMaker: /spalding/i,
'league.type': 'NBA'
})
↓ ↓ ↓ ↓ ↓ ↓
const isNbaBasketball = arg => {
if (arg?.type === 'basketball') return true
if (arg?.ballColor === 'orange') return true
if (/spalding/i.test(arg?.ballMaker)) return true
if (arg?.league?.type === 'NBA') return true
return false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment