mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-11 07:34:51 +03:00
refactor contrats check
This commit is contained in:
parent
2855fca34f
commit
383a41d3a0
|
@ -369,11 +369,14 @@ export function isNamedDefinition(pointer?: string): boolean {
|
||||||
}
|
}
|
||||||
|
|
||||||
function humanizeMultipleOfConstraint(multipleOf: number | undefined): string | undefined {
|
function humanizeMultipleOfConstraint(multipleOf: number | undefined): string | undefined {
|
||||||
if (multipleOf === undefined) return;
|
if (multipleOf === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const strigifiedMultipleOf = multipleOf.toString(10);
|
const strigifiedMultipleOf = multipleOf.toString(10);
|
||||||
const parts = strigifiedMultipleOf.split('.');
|
if (!/^0\.0*1$/.test(strigifiedMultipleOf)) {
|
||||||
if (parts.length < 2 || !/^0*1$/.test(parts[1])) return `multiple of ${strigifiedMultipleOf}`;
|
return `multiple of ${multipleOf}`;
|
||||||
return `decimals <= ${parts[1].length} digits`;
|
}
|
||||||
|
return `decimals <= ${strigifiedMultipleOf.split('.')[1].length} digits`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function humanizeRangeConstraint(
|
function humanizeRangeConstraint(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user