MCPcopy Create free account
hub / github.com/Effect-TS/effect / isIncluding

Function isIncluding

packages/effect/src/Schema.ts:7364–7383  ·  view source on GitHub ↗
(includes: string, annotations?: Annotations.Filter)

Source from the content-addressed store, hash-verified

7362 * @since 4.0.0
7363 */
7364export 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
7385const UPPERCASED_PATTERN = "^[^a-z]*$"
7386/**

Callers

nothing calls this directly

Calls 3

literalToJsonSchemaFunction · 0.85
makeFilterFunction · 0.70
replaceMethod · 0.45

Tested by

no test coverage detected