UNPKG

476 BJavaScriptView Raw
1import { matchesStringOrRegExp } from './matchesStringOrRegExp'
2
3/**
4 * Check if an options object's propertyName contains a user-defined string or
5 * regex that matches the passed in input.
6 */
7export function optionsMatches (
8 options /*: Object */,
9 propertyName /*: string */,
10 input /*: string */
11) /*: boolean */ {
12 return !!(
13 options &&
14 options[propertyName] &&
15 typeof input === 'string' &&
16 matchesStringOrRegExp(input, options[propertyName])
17 )
18}