Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ You can pass a string representation of a location and a callback function to `g
###Example:

```javascript
var geocoder = require('geocoder');
var geocoder = require('react-geocoder-component');

// Geocoding
geocoder.geocode("Atlanta, GA", function ( err, data ) {
Expand Down
18 changes: 11 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
* Version
*/

var version = '0.2.1';
var version = '1.0.0';
const googleProvider = require("./providers/google");
const yahooProvider = require("./providers/yahoo");


/**
* Geocoder
* Geocoder
*/

function Geocoder () {
Expand All @@ -30,7 +32,7 @@ Geocoder.prototype = {

/**
* Selects a webservice provider
*
*
* @param {String} name, required
* @param {Object} opts, optional
* @api public
Expand All @@ -44,13 +46,15 @@ Geocoder.prototype = {

this.provider = name;
this.providerOpts = opts || {};
this.providerObj = require("./providers/"+name);
if (name === 'google') this.providerObj = googleProvider;
else if (name === 'yahoo') this.providerObj = yahooProvider;
else this.providerObj = require("./providers/"+name);

},

/**
* Request geocoordinates of given `loc` from Google
*
*
* @param {String} loc, required
* @param {Function} cbk, required
* @param {Object} opts, optional
Expand All @@ -62,7 +66,7 @@ Geocoder.prototype = {
if ( ! loc ) {
return cbk( new Error( "Geocoder.geocode requires a location.") );
}

return this.providerObj.geocode(this.providerOpts, loc, cbk, opts);

},
Expand All @@ -78,7 +82,7 @@ Geocoder.prototype = {

/**
* Return Geocoder version
*
*
* @api public
*/

Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"name": "geocoder",
"name": "react_geocoder",
"description": "Geocoding through Google's Developer API",
"version": "0.2.2",
"version": "1.0.0",
"main": "./index.js",
"description": "node wrapper around google's geocoder api",
"author": "Stephen Wyatt Bush <stephen.wyatt@gmail.com>",
"repository" : "git://github.com/wyattdanger/geocoder",
"homepage" : "https://github.com/wyattdanger/geocoder",
"author": "Besat Zardosht",
"repository" : "https://github.com/BesatZardosht/geocoder",
"keywords" : [ "google", "geocode", "geonames", "reverse geocode" ],
"license": {
"type": "Apachev2",
Expand Down