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 24 25 | 11x 11x 11x 11x 1x 1x 10x 1x 10x | import type { ValidationResult, ValidationError, ValidationWarning } from '../../types.js';
import { err } from './helpers.js';
import { DURATION_DESCRIPTORS } from './__generated-allowlists.js';
export default function validateDuration(
segments: string[],
aliases: Record<string, string> = {},
): ValidationResult {
const errors: ValidationError[] = [];
const warnings: ValidationWarning[] = [];
const value = segments.join('-');
if (segments.length === 0) {
errors.push(err('duration', 'a named value after duration', '(empty)'));
return { errors, warnings };
}
if (!DURATION_DESCRIPTORS.includes(value)) {
errors.push(err('duration-value', DURATION_DESCRIPTORS, value));
}
return { errors, warnings };
}
|