mirror of
https://github.com/modrinth/code.git
synced 2026-08-31 03:55:59 +00:00
11 lines
366 B
TypeScript
11 lines
366 B
TypeScript
import type { FieldValidationMessage, ValidationRuleMatch } from './types.ts'
|
|
|
|
export function toFieldMessages(matches: ValidationRuleMatch[]): FieldValidationMessage[] {
|
|
return matches.map((match) => ({
|
|
code: match.code,
|
|
severity: match.rule.severity,
|
|
message: match.message,
|
|
values: Object.keys(match.values).length > 0 ? match.values : undefined,
|
|
}))
|
|
}
|