extract-location
v0.0.4
Published
Extract country, state and city from a string.
Downloads
3
Maintainers
Readme
High performance lib to Extract City and Country from any String
Installation
npm i --save extract-location
Usage
import extractLocation from 'extract-location';
extractLocation( strongToSearch: string, countryToSearchIn: string ): undefined | {
country: string,
city?: string,
reliability: 1 | 2 | 3
};
Usage examples
extractLocation("Location: Paris (16)");
{
"country": "France",
"city": "Paris",
"reliability": 2
}
extractLocation("Paris, United States");
{
"country": "United States",
"city": "Paris",
"reliability": 3
}
extractLocation("Paris, United States", "Canada");
{
"country": "Canada",
"city": "Paris",
"reliability": 3
}
extractLocation("There is no location here");
undefined