conditional-expression icon indicating copy to clipboard operation
conditional-expression copied to clipboard

Feature request: isIn (array) or isOneOf

Open photonite opened this issue 4 years ago • 0 comments

A useful method to check if an expression exists in an array, example:

const fruits = ['apple', 'orange']
const vegetables = ['eggplant', 'carrot']
const food = 'apple'

const foodCatrgory = match(food)
   .isOneOf(fruits).then('fruit')
   .isOneOf(vegetables).then('vegetable')
   .else('not food')

photonite avatar Feb 03 '21 14:02 photonite