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

Function collectIssues

packages/effect/src/SchemaAST.ts:4038–4068  ·  view source on GitHub ↗
(
  checks: ReadonlyArray<Check<T>>,
  value: T,
  issues: Arr.NonEmptyArray<SchemaIssue.Issue> | undefined,
  ast: AST,
  options: ParseOptions
)

Source from the content-addressed store, hash-verified

4036
4037/** @internal */
4038export function collectIssues<T>(
4039 checks: ReadonlyArray<Check<T>>,
4040 value: T,
4041 issues: Arr.NonEmptyArray<SchemaIssue.Issue> | undefined,
4042 ast: AST,
4043 options: ParseOptions
4044): Arr.NonEmptyArray<SchemaIssue.Issue> | undefined {
4045 for (let i = 0; i < checks.length; i++) {
4046 const check = checks[i]
4047 if (check._tag === "FilterGroup") {
4048 issues = collectIssues(check.checks, value, issues, ast, options)
4049 if (
4050 issues &&
4051 (options.errors !== "all" || (issues[issues.length - 1] as SchemaIssue.Filter).filter.aborted)
4052 ) {
4053 return issues
4054 }
4055 } else {
4056 const issue = check.run(value, ast, options)
4057 if (issue) {
4058 const filter = new SchemaIssue.Filter(check, issue, value, options)
4059 if (issues) issues.push(filter)
4060 else issues = [filter]
4061 if (options.errors !== "all" || check.aborted) {
4062 return issues
4063 }
4064 }
4065 }
4066 }
4067 return issues
4068}
4069
4070/** @internal */
4071export function runChecks<T>(

Callers 5

matchPartMethod · 0.85
_matchMethod · 0.85
matchKeyMethod · 0.85
matchPartMethod · 0.85
runChecksFunction · 0.85

Calls 2

pushMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected