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 26 27 28 29 30 31 32 33 34 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 770x 770x 770x 770x 770x 770x 770x 641x 641x 641x 641x 641x 770x 129x 129x | /**
* Shared below-minimum / above-cap refusal wording (spec FR-018a). Both the
* paste composer (FR-018) and the scoped-region refusal (FR-034) state the
* same bound violation the same way — a reviewer or user who hits one and
* later the other should read one rule, not two unrelated messages. The
* caller supplies only the next-action clause, which differs by context.
*/
export interface BoundViolation {
message: string;
action: string;
}
export function boundViolation(
length: number,
min: number,
max: number,
tooSmallAction: string,
tooLargeAction: string
): BoundViolation | null {
if (length < min) {
return {
message: `That's under the ${min.toLocaleString()}-character minimum.`,
action: tooSmallAction,
};
}
if (length > max) {
return {
message: `That's over the ${max.toLocaleString()}-character limit.`,
action: tooLargeAction,
};
}
return null;
}
|