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

Function isIncludes

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

Source from the content-addressed store, hash-verified

7332 * @since 4.0.0
7333 */
7334export 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.

Callers 1

Schema.tsFile · 0.85

Calls 2

formatFunction · 0.90
makeFilterFunction · 0.85

Tested by

no test coverage detected