Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@gojob/google-place
Advanced tools
A small node module to use the Google Place API written in typescript
This package is a library for Node.js to consume the Google Place autocomplete & details API. It returns a small subset of their data.
yarn add @gojob/google-place
import * as gp from '@gojob/google-place';
const results = await gp.autocomplete({
key: 'YOUR_API_KEY',
input: 'Port-de-Bouc',
language: 'fr',
countries: ['fr'],
});
query
)Name | Type | Description |
---|---|---|
key | string | Google API Key |
input | string | Searched entry |
language | string | Language to use (optional) Google Code |
countries | string[] | Filter on a country (optional) ISO 3166-1 Alpha-2 |
Returns a list of prediction or throw if an error occurred.
interface IPrediction {
id: string;
name: string;
}
As:
Name | Type | Description |
---|---|---|
id | string | Place id |
name | string | Place name |
query
)const place = gp.retrieve({
key: 'YOUR_API_KEY',
id: 'ChIJ-RzUxt8ethIRksIaOl-0tJY',
language: 'fr',
});
As:
Name | Type | Description |
---|---|---|
key | string | Google API Key |
id | string | Searched entry |
language | string | Language to use (optional) Google Code |
Returns a place or throw if an error occurred.
export interface ILocation {
lat: number;
lng: number;
}
export interface IPlace {
id: string;
address: string;
location: ILocation;
postalCode: string;
locality: string;
administrativeAreaLevel1: string;
administrativeAreaLevel2: string;
countryCode: string;
country: string;
}
As:
Name | Type | Description |
---|---|---|
id | string | Place id |
address | string | Formatted address |
location | object | Latitude and longitude coordinates |
postalCode | string | Postal code |
locality | string | Locality name (long or short name) |
administrativeAreaLevel1 | string | Administrative Area Level 1 (long or short name) |
administrativeAreaLevel2 | string | Administrative Area Level 2 (long or short name) |
countryCode | string | Country short name |
stateCode | string | Administrative Area Level 1 (short name) |
country | string | Country name (long name) |
postalCode, administrativeAreaLevel1 or administrativeAreaLevel2 may be empty string
const place = gp.reverseGeocode({
key: 'YOUR_API_KEY',
latlng: 'XXX,YYY',
language: 'fr',
});
As:
Name | Type | Description |
---|---|---|
key | string | Google API Key |
latlng | string | Latitude and longitude coordinates (coma separated) |
language | string | Language to use (optional) Google Code |
Find an address from a location coordinates. Returns a IPlace
.
[1.8.0] - 2023-04-20
stateCode
in retrieve
and reverse-geocode
FAQs
A small node module to use the Google Place API written in typescript
The npm package @gojob/google-place receives a total of 555 weekly downloads. As such, @gojob/google-place popularity was classified as not popular.
We found that @gojob/google-place demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.