Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
google-current-geocode
Advanced tools
Quick utility package to handle location permission and use current location to get complete location info using google places geocoding api.
A quick utility package to handle location permissions and retrieve complete location information using the Google Places Geocoding API.
This package is currently in the Beta Testing phase. We are testing it with the most commonly used libraries and frameworks while aiming to create frequently used location features. Feel free to contribute!
npm install google-current-geocode
Get your Google API key from Google Cloud Console
Add the Google API script using the best approach for your project, or simply use the setupGooglePlacesApiScript function provided by the package:
import { setupGooglePlacesApiScript } from "google-current-geocode";
// common usage
const googleApiKey = process.env.GOOGLE_API_KEY;
if(googleApiKey) setupGooglePlacesApiScript(googleApiKey);
// for React
useEffect(() => {
const googleApiKey = process.env.REACT_APP_GOOGLE_API_KEY;
if(googleApiKey) setupGooglePlacesApiScript(googleApiKey)
}, [])
import { getCurrentLocationDetails } from "google-current-geocode";
// common usage
document.querySelector("#location").addEventListener("click", () => getCurrentLocationDetails());
// for React
<button onClick={() => getCurrentLocationDetails()}>Get Location</button>
npm install @types/google.maps
You can pass options to customize the behavior of the getCurrentLocationDetails function:
getCurrentLocationDetails({ cache: true })
Name | Type | Description |
---|---|---|
cache | boolean | Avoids calling the Google Geocoding API by caching location information based on latitude and longitude. |
FAQs
Quick utility package to handle location permission and use current location to get complete location info using google places geocoding api.
We found that google-current-geocode demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.