UNPKG

validatable

Version:

A library for synchronous and asynchronous input validation.

14 lines (9 loc) 300 B
import { isArray } from 'typeable'; export interface ArrayInclusionOptions { values?: any[]; } export function arrayInclusion (value: any, options: ArrayInclusionOptions = {}): boolean { let { values } = options; if (!isArray(values)) return false; return values.indexOf(value) !== -1; }