( pattern: pattern )
| 898 | when((value) => isString(value) && Boolean(value.match(expr))); |
| 899 | |
| 900 | const stringChainable = <pattern extends Matcher<any, any, any, any, any>>( |
| 901 | pattern: pattern |
| 902 | ): StringChainable<pattern> => |
| 903 | Object.assign(chainable(pattern), { |
| 904 | startsWith: (str: string) => |
| 905 | stringChainable(intersection(pattern, startsWith(str))), |
| 906 | endsWith: (str: string) => |
| 907 | stringChainable(intersection(pattern, endsWith(str))), |
| 908 | minLength: (min: number) => |
| 909 | stringChainable(intersection(pattern, minLength(min))), |
| 910 | length: (len: number) => |
| 911 | stringChainable(intersection(pattern, length(len))), |
| 912 | maxLength: (max: number) => |
| 913 | stringChainable(intersection(pattern, maxLength(max))), |
| 914 | includes: (str: string) => |
| 915 | stringChainable(intersection(pattern, includes(str))), |
| 916 | regex: (str: string) => stringChainable(intersection(pattern, regex(str))), |
| 917 | }) as any; |
| 918 | |
| 919 | /** |
| 920 | * `P.string` is a wildcard pattern, matching any **string**. |
no test coverage detected
searching dependent graphs…