diff --git a/README.markdown b/README.markdown index 1cf6ce7..2c1513c 100644 --- a/README.markdown +++ b/README.markdown @@ -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 ) { diff --git a/index.js b/index.js index c86efa6..3529ec0 100644 --- a/index.js +++ b/index.js @@ -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 () { @@ -30,7 +32,7 @@ Geocoder.prototype = { /** * Selects a webservice provider - * + * * @param {String} name, required * @param {Object} opts, optional * @api public @@ -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 @@ -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); }, @@ -78,7 +82,7 @@ Geocoder.prototype = { /** * Return Geocoder version - * + * * @api public */ diff --git a/package.json b/package.json index 2b4a34f..a5eef49 100644 --- a/package.json +++ b/package.json @@ -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 ", - "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",