Hyperlinkv0.8.0-beta.28

Schema

Schema.isIncludesfunctioneffect/Schema.ts:6913
(
  includes: string,
  annotations?: Annotations.Filter
): SchemaAST.Filter<string>

Validates at runtime that a string contains the specified literal substring.

Details

Notes: The JSON Schema and arbitrary metadata use the substring as a raw regexp pattern. If the substring contains regexp syntax, generated patterns may not be equivalent to the runtime includes check.

String checks
Source effect/Schema.ts:691320 lines
export function isIncludes(includes: string, annotations?: Annotations.Filter) {
  const formatted = JSON.stringify(includes)
  return makeFilter(
    (s: string) => s.includes(includes),
    {
      expected: `a string including ${formatted}`,
      meta: {
        _tag: "isIncludes",
        includes,
        regExp: new globalThis.RegExp(includes)
      },
      arbitrary: {
        constraint: {
          patterns: [includes]
        }
      },
      ...annotations
    }
  )
}
Referenced by 1 symbols