• Creates a Predicate for Strings.

    Example

    Match against an array of allowed values

    const isAorB = stringPredicate(['a', 'b']);
    const matches = isAorB('b');
    console.log(matches); // true

    Example

    Match against a RegExp

    const startsWithA = stringPredicate(/a.+/);
    const matches = startsWithA('ab');
    console.log(matches); // true

    Returns

    the Predicate

    Parameters

    Returns Predicate<[string]>

Generated using TypeDoc