Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 10x 10x 10x 2x 2x 8x 1x 8x | import type { ValidationResult, ValidationError, ValidationWarning } from '../../types.js';
import { err } from './helpers.js';
import { RATIO_DESCRIPTORS } from './__generated-allowlists.js';
export default function validateRatio(
segments: string[],
aliases: Record<string, string> = {},
): ValidationResult {
const errors: ValidationError[] = [];
const warnings: ValidationWarning[] = [];
if (segments.length !== 1) {
errors.push(err('ratio', 'exactly one named value after ratio', segments.join('-') || '(empty)'));
return { errors, warnings };
}
if (!RATIO_DESCRIPTORS.includes(segments[0])) {
errors.push(err('ratio-value', RATIO_DESCRIPTORS, segments[0] ?? '(empty)'));
}
return { errors, warnings };
}
|