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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 15x 15x 1x 1x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 15x 121x 121x 12x 12x 12x 2x 2x | import { planetIndexMax, planetIndexMin, solarSystemIndexMax, solarSystemIndexMin, voxelMax, voxelMin, } from '@/constants/restrictions'; import type { ValidationResult } from '@/contracts/validationResult'; import type { Validator } from '@/types/validator'; import type { VoxelInput } from '@/types/voxelTypes'; import { maxValue, minValue } from './numberValidation'; import { notNull } from './baseValidation'; import { validationMessage } from '@/constants/validationMessages'; export const VoxelInputValidator: Validator<VoxelInput> = (inputProps: VoxelInput) => { const mainObjValidationResult = notNull(validationMessage.cannotBeNull('voxelInput'))(inputProps); if (mainObjValidationResult.isValid === false) { return mainObjValidationResult; } const validations: Array<() => ValidationResult> = [ () => notNull(validationMessage.cannotBeNull('VoxelX'))(inputProps.VoxelX), () => minValue(voxelMin, 'VoxelX')(inputProps.VoxelX), () => maxValue(voxelMax, 'VoxelX')(inputProps.VoxelX), // () => notNull(validationMessage.cannotBeNull('VoxelY'))(inputProps.VoxelY), () => minValue(voxelMin, 'VoxelY')(inputProps.VoxelY), () => maxValue(voxelMax, 'VoxelY')(inputProps.VoxelY), // () => notNull(validationMessage.cannotBeNull('VoxelZ'))(inputProps.VoxelZ), () => minValue(voxelMin, 'VoxelZ')(inputProps.VoxelZ), () => maxValue(voxelMax, 'VoxelZ')(inputProps.VoxelZ), // () => notNull(validationMessage.cannotBeNull('SolarSystemIndex'))(inputProps.SolarSystemIndex), () => minValue(solarSystemIndexMin, 'SolarSystemIndex')(inputProps.SolarSystemIndex), () => maxValue(solarSystemIndexMax, 'SolarSystemIndex')(inputProps.SolarSystemIndex), // () => notNull(validationMessage.cannotBeNull('PlanetIndex'))(inputProps.PlanetIndex), () => minValue(planetIndexMin, 'PlanetIndex')(inputProps.PlanetIndex), () => maxValue(planetIndexMax, 'PlanetIndex')(inputProps.PlanetIndex), ]; for (const validation of validations) { const result = validation(); if (result.isValid === true) continue; return result; } return { isValid: true }; }; |