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

node-geocoder

Package Overview
Dependencies
Maintainers
1
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-geocoder - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

lib/geocoder/mapquestgeocoder.js

17

lib/geocoderfactory.js

@@ -23,3 +23,3 @@ (function() {

},
_getGeocoder: function(geocoderName, adapter) {
_getGeocoder: function(geocoderName, adapter, extra) {
if (geocoderName === 'google') {

@@ -45,2 +45,7 @@ var GoogleGeocoder = new require('./geocoder/googlegeocoder.js');

}
if (geocoderName === 'mapquest') {
var MapQuestGeocoder = new require('./geocoder/mapquestgeocoder.js');
return new MapQuestGeocoder(adapter, extra.apiKey);
}
},

@@ -54,3 +59,3 @@ _getFormatter: function(formatterName) {

},
getGeocoder: function(geocoderAdapter, httpAdapter, formatter) {
getGeocoder: function(geocoderAdapter, httpAdapter, extra) {

@@ -61,2 +66,6 @@ if (!httpAdapter || httpAdapter === 'undefined') {

if (!extra || extra == 'undefinded') {
extra = {};
}
if (Helper.isString(httpAdapter)) {

@@ -67,5 +76,7 @@ httpAdapter = this._getHttpAdapter(httpAdapter);

if (Helper.isString(geocoderAdapter)) {
geocoderAdapter = this._getGeocoder(geocoderAdapter, httpAdapter);
geocoderAdapter = this._getGeocoder(geocoderAdapter, httpAdapter, extra);
}
formatter = extra.formatter;
if (Helper.isString(formatter)) {

@@ -72,0 +83,0 @@ formatter = this._getFormatter(formatter);

2

package.json
{
"name": "node-geocoder",
"version": "0.2.0",
"version": "0.3.0",
"description": "node geocoding library",

@@ -5,0 +5,0 @@ "main": "lib/geocoderfactory.js",

@@ -20,2 +20,3 @@ # node-geocoder

* `openstreetmap` : OpenStreetMapGeocoder support adress geocoding and reverse geocoding
* `mapquest` : MapQuestGeocoder support adress geocoding and reverse geocoding need an apiKey

@@ -35,5 +36,9 @@ ## Http adapter

var httpAdapter = 'http';
var formatter = null;
// optionnal
var extra = {
apiKey: 'YOUR_API_KEY',
formatter: null
};
var geocoder = require('node-geocoder').getGeocoder(geocoderProvider, httpAdapter, formatter);
var geocoder = require('node-geocoder').getGeocoder(geocoderProvider, httpAdapter, extra);

@@ -57,4 +62,2 @@ geocoder.geocode('29 champs elysée paris', function(err, res) {

## More

@@ -61,0 +64,0 @@

@@ -7,3 +7,3 @@ var GoogleAdapter = require ('./lib/geocoder/googlegeocoder.js');

var adapter = GeocoderFactory.getGeocoder('google', 'http', 'gpx');
var adapter = GeocoderFactory.getGeocoder('mapquest', 'http', {apiKey: 'Fmjtd%7Cluubn962n5%2C2x%3Do5-907xgz'});

@@ -16,6 +16,6 @@ //var adapter = new GoogleAdapter(new RequestifyAdapter());

});
adapter.geocode('29 rue chevreul lyon', function(err, res) {
console.log(err);
console.log(res);
});
// adapter.geocode('29 rue chevreul lyon FR', function(err, res) {
// console.log(err);
// console.log(res);
// });

@@ -22,0 +22,0 @@ setTimeout(function() {

@@ -30,3 +30,3 @@ (function() {

it('called with "google" and "http" and "gpx" must return google geocoder with http adapter and gpx formatter', function() {
var geocoder = GeocoderFactory.getGeocoder('google', 'http', 'gpx');
var geocoder = GeocoderFactory.getGeocoder('google', 'http', { formatter : 'gpx'});

@@ -33,0 +33,0 @@ var geocoderAdapter = geocoder._geocoder;

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