import dotenv from "dotenv";
import { LocationBot } from "location-bot";
dotenv.config();
const locationBot = new LocationBot(process.env.LOCATION_BOT_API_KEY);
// Extract location from a string, even with spelling errors
const location = await locationBot.extractLocation("Nairobi, Kenia");
console.log(location);
1
2
3
4
5
{
"country": "Kenya",
"state": "Nairobi",
"city": "Nairobi"
}