UNPKG

rambda

Version:

Lightweight faster alternative to Ramda

21 lines (15 loc) 423 B
import { equals } from './equals' export function includes(valueToFind, input){ if (arguments.length === 1) return _input => includes(valueToFind, _input) if (typeof input === 'string'){ return input.includes(valueToFind) } if (!Array.isArray(input)) return false let index = -1 while (++index < input.length){ if (equals(input[ index ], valueToFind)){ return true } } return false }