a-synchronous/rubico

x/isIn

richytong opened this issue · 3 comments

counterpart to includes

const myArray = [1, 2, 3]

isIn(myArray)(1) // true
isIn(myArray)(5) // false

should work for objects, maps, and sets as well

const myObject = { a: 1 }

isIn(myObject)(1) // true, `isIn` checks values
isIn(myObject)('a') // false, use `has` for object keys

const mySet = new Set([1, 2, 3])

isIn(mySet)(1) // true

const myMap = new Map()
myMap.set('a', 1)

isIn(myMap)(1) // true

also strings

const myString = 'hey'

isIn(myString)('he') // true
isIn(myString)('ye') // false

get it

brownie points for adding eager api

const myArray = [1, 2, 3]

isIn(1, myArray) // true

@richytong close?