(includes: string, annotations?: Annotations.Filter)
| 7362 | * @since 4.0.0 |
| 7363 | */ |
| 7364 | export function isIncluding(includes: string, annotations?: Annotations.Filter) { |
| 7365 | const formatted = JSON.stringify(includes) |
| 7366 | const regExp = new globalThis.RegExp(RegExp_.escape(includes)) |
| 7367 | const jsonSchemaLiteral = includes.replace(/^[\uDC00-\uDFFF]|[\uD800-\uDBFF]$/g, "") |
| 7368 | return makeFilter( |
| 7369 | (s: string) => s.includes(includes), |
| 7370 | { |
| 7371 | expected: `a string including ${formatted}`, |
| 7372 | representation: { |
| 7373 | id: "effect/schema/isIncluding", |
| 7374 | payload: { includes } |
| 7375 | }, |
| 7376 | toJsonSchema: () => literalToJsonSchema(jsonSchemaLiteral, includes, RegExp_.escape(jsonSchemaLiteral)), |
| 7377 | arbitraryConstraint: { |
| 7378 | patterns: [{ source: regExp.source, flags: regExp.flags }] |
| 7379 | }, |
| 7380 | ...annotations |
| 7381 | } |
| 7382 | ) |
| 7383 | } |
| 7384 | |
| 7385 | const UPPERCASED_PATTERN = "^[^a-z]*$" |
| 7386 | /** |
nothing calls this directly
no test coverage detected