Skip to content

capturr/extract-location

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

High performance lib to Extract City and Country from any String

npm npm

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

About

Extract Country, State and Country from a string

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published