MCPcopy Index your code
hub / github.com/callstack/agent-device / validateLocationCoordinate

Function validateLocationCoordinate

src/utils/location-coordinates.ts:29–36  ·  view source on GitHub ↗
(value: unknown, label: LocationCoordinateLabel)

Source from the content-addressed store, hash-verified

27}
28
29function 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}

Callers 2

readLocationCoordinateFunction · 0.85

Calls 1

isFiniteMethod · 0.80

Tested by

no test coverage detected