check-geographic-coordinates
v1.0.5
Published
Verify if geographic coordinates are valid 🌎 (latitude, longitude, both).
Downloads
314
Maintainers
Keywords
Readme
Check geographic coordinates
Verifies if geo coordinates are valid. 🌎 (longitude, latitude, both).
Install
npm install check-geographic-coordinates
//or
yarn add check-geographic-coordinates
Usage
const checkGeo = require("check-geographic-coordinates");
//ROME
const lon = 12.496366;
const lat = 41.902783;
//longitude, return true
checkGeo.longitude(lon); // also: isLongitude, isValidLongitude
//latitude, return true
checkGeo.latitude(lat); // also isLatitude, isValidLatitude
//cordinate, return true
checkGeo.coordinates(lon, lat); // also areCoordinates, areValidCoordinates
Usage with typescript
import { latitude, longitude, coordinates } from "check-geographic-coordinates";
//ROME
const lon = 12.496366;
const lat = 41.902783;
//longitude, return true
longitude(lon); // also: isLongitude, isValidLongitude
//latitude, return true
latitude(lat); // also isLatitude, isValidLatitude
//cordinate, return true
coordinates(lon, lat); // also areCoordinates, areValidCoordinates
Tests
npm run test
//or
yarn test