Skip to content

Solve the browserify issue of not being able to resolve require inside the code #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
@@ -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 ) {
18 changes: 11 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -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
*/

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 <[email protected]>",
"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",