@sharyn/util.either
v1.0.1
Published
**`either`** returns `true` if the first argument equals any of the other arguments.
Downloads
2,102
Readme
🌹 either
either returns true if the first argument equals any of the other arguments.
Basically, you can replace this:
if (something === 'foo' || something === 'bar' || something === 'baz')
// or
if (['foo', 'bar', 'baz'].includes(something))By this:
import either from '@sharyn/util/either'
// or import { either } from '@sharyn/util'
if (either(something, 'foo', 'bar', 'baz'))either uses deep equality so you can test objects as well:
either(obj, { a: 1 }, { a: 2 })either is part of @sharyn/util
