Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-geocoding

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-geocoding - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

index.d.ts

5

CHANGELOG.md
## Release Notes
### 0.4.0
- Fixed fetching options
- Removed deprecated code
### 0.3.0

@@ -4,0 +9,0 @@

58

Geocoder.js

@@ -1,3 +0,1 @@

let API_KEY;
/**

@@ -8,9 +6,14 @@ * Module to use google's geocoding & reverse geocoding.

export default Geocoder = {
apiKey : null,
options : {},
/**
* Initialize the module.
* @param {String} apiKey The api key of your application in google.
* @param {Object} [options] extra options for your geocoding request.
* @see https://developers.google.com/maps/documentation/geocoding/intro#geocoding
*/
init(apiKey){
API_KEY = apiKey;
init(apiKey, options = {}) {
this.apiKey = apiKey;
this.options = options;
},

@@ -21,15 +24,7 @@

*/
get isInit(){
return !! API_KEY;
get isInit() {
return !!this.apiKey;
},
/**
* @see {@link Geocoder.init}
* @deprecated
*/
setApiKey(API_KEY) {
this.init(API_KEY);
},
/**
* Do <a href="https://developers.google.com/maps/documentation/geocoding/intro#ReverseGeocoding">(reverse) geocoding</a>, converting geographic coordinates into a human-readable address & vice-versa.

@@ -74,3 +69,2 @@ * Accepted parameters:

// --- start geocoding ---

@@ -86,6 +80,5 @@

queryParams.key = API_KEY;
queryParams = { key: this.apiKey, ...this.options, ...queryParams }
// build url
const url = 'https://maps.google.com/maps/api/geocode/json?' + toQueryParams(queryParams);
const url = `https://maps.google.com/maps/api/geocode/json?${toQueryParams(queryParams)}`;

@@ -128,27 +121,2 @@ let response, data;

/**
* <a href="https://developers.google.com/maps/documentation/geocoding/intro#geocoding">Geocodes</a>, converting address into a geographic coordinates.
* Use {@link Geocoder.from} instead.
* @param {String} address Address to reverse geocode.
* @returns {Promise.<Object>} Object containing informations about the place and the coordinates.
* @see https://developers.google.com/maps/documentation/geocoding/intro#Viewports
* @deprecated
*/
getFromLocation(address) {
return this.from(address);
},
/**
* Do <a href="https://developers.google.com/maps/documentation/geocoding/intro#ReverseGeocoding">reverse geocoding</a>, converting geographic coordinates into a human-readable address.
* Use {@link Geocoder.from} instead.
* @param {Number} lat Latitude coordinate.
* @param {Number} lng Longitude coordinate.
* @returns {Promise.<Object>} Object containing informations about the place at the coordinates.
* @see https://developers.google.com/maps/documentation/geocoding/intro#GeocodingResponses
* @deprecated
*/
getFromLatLng(lat, lng){
return this.from(lat, lng);
},
/**
* All possible errors.

@@ -192,3 +160,3 @@ */

*/
function toQueryParams(object){
function toQueryParams(object) {
return Object.keys(object)

@@ -198,2 +166,2 @@ .filter(key => !!object[key])

.join("&")
}
}
{
"name": "react-native-geocoding",
"version": "0.3.0",
"version": "0.4.0",
"description": "A React Native module to transform a description of a location (i.e. street address, town name, etc.) into geographic coordinates (i.e. latitude and longitude) and vice versa.",
"main": "Geocoder.js",
"typings": "./index.d.ts",
"repository": {

@@ -17,4 +18,7 @@ "type": "git",

],
"authors": ["Marco Lovetere <marco@marlove.net> (https://marlove.net)", "Yairopro <yairopro@gmail.com>"],
"authors": [
"Marco Lovetere <marco@marlove.net> (https://marlove.net)",
"Yairopro <yairopro@gmail.com>"
],
"license": "MIT"
}

@@ -18,4 +18,6 @@ # react-native-geocoding

// to do only once
Geocoder.init('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); // use a valid API key
// Initialize the module (needs to be done only once)
Geocoder.init("xxxxxxxxxxxxxxxxxxxxxxxxx"); // use a valid API key
// With more options
// Geocoder.init("xxxxxxxxxxxxxxxxxxxxxxxxx", {language : "en"}); // set the language

@@ -29,5 +31,5 @@ Geocoder.from("Colosseum")

Geocoder.from(41.89, 12.49).
Geocoder.from(41.89, 12.49)
.then(json => {
var addressComponent = json.results[0].address_components[0];
var addressComponent = json.results[0].address_components[0];
console.log(addressComponent);

@@ -39,2 +41,3 @@ })

// ------------
// location object

@@ -45,2 +48,3 @@ Geocoder.from({

});
// latlng object

@@ -51,2 +55,3 @@ Geocoder.from({

});
// array

@@ -68,2 +73,2 @@ Geocoder.from([41.89, 12.49]);

See [CHANGELOG.md](https://github.com/marlove/react-native-geocoding/blob/master/CHANGELOG.md)
See [CHANGELOG.md](https://github.com/marlove/react-native-geocoding/blob/master/CHANGELOG.md)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc