(includes: string, annotations?: Annotations.Filter)
| 7332 | * @since 4.0.0 |
| 7333 | */ |
| 7334 | export function isIncludes(includes: string, annotations?: Annotations.Filter) { |
| 7335 | const formatted = JSON.stringify(includes) |
| 7336 | const regExp = new globalThis.RegExp(RegExp_.escape(includes)) |
| 7337 | return makeFilter( |
| 7338 | (s: string) => s.includes(includes), |
| 7339 | { |
| 7340 | expected: `a string including ${formatted}`, |
| 7341 | representation: { |
| 7342 | id: "effect/schema/isIncludes", |
| 7343 | payload: { includes } |
| 7344 | }, |
| 7345 | toJsonSchema: () => ({ pattern: regExp.source }), |
| 7346 | toCode: () => ({ runtime: `Schema.isIncludes(${format(includes)})` }), |
| 7347 | arbitrary: { |
| 7348 | constraint: { |
| 7349 | patterns: [regExp.source] |
| 7350 | } |
| 7351 | }, |
| 7352 | ...annotations |
| 7353 | } |
| 7354 | ) |
| 7355 | } |
| 7356 | |
| 7357 | /** |
| 7358 | * Reviver for persisted `isIncludes` checks. |
no test coverage detected