import { curryN } from "@unboxing/function"; import { indexOf } from "./indexOf"; interface Includes { (value: string, array: string): boolean; (value: T, array: ArrayLike): boolean; (value: T): (array: ArrayLike | string) => boolean; } /** * Dispatches call to arr.indexOf, returns true if arr is array and value in the array or * if arr is string and value is substring of arr */ export const includes = curryN(2, (value: T, arr: ArrayLike = []) => indexOf(value, arr) !== -1) as Includes