(value: unknown, label: LocationCoordinateLabel)
| 27 | } |
| 28 | |
| 29 | function validateLocationCoordinate(value: unknown, label: LocationCoordinateLabel): number { |
| 30 | const min = label === 'latitude' ? -90 : -180; |
| 31 | const max = label === 'latitude' ? 90 : 180; |
| 32 | if (typeof value !== 'number' || !Number.isFinite(value) || value < min || value > max) { |
| 33 | throw new AppError('INVALID_ARGS', `${label} must be a number from ${min} to ${max}`); |
| 34 | } |
| 35 | return value; |
| 36 | } |
no test coverage detected