UNPKG

validatable

Version:

A library for synchronous and asynchronous input validation.

13 lines (9 loc) 314 B
import { isString, toString } from 'typeable'; export interface StringInclusionOptions { seed?: string; } export function stringInclusion (value: any, options: StringInclusionOptions = {}): boolean { if (!isString(value)) return false; let {seed} = options; return value.indexOf(toString(seed)) >= 0; }