Permalink
Browse files

Refactor

  • Loading branch information...
1 parent 732d37f commit 66d4dbb7cdb6b04780d3cb1dccb3387985adbcef @edwlook committed Apr 28, 2014
Showing with 2 additions and 2 deletions.
  1. +2 −2 index.js
View
@@ -55,12 +55,12 @@ GoogleDistance.prototype.formatResults = function(data, options, callback) {
if (requestStatus != 'OK') {
return callback(new Error('Status error: ' + requestStatus + ': ' + data.error_message));
}
- var resultStatus = data.rows[0].elements[0].status;
+ var element = data.rows[0].elements[0];
+ var resultStatus = element.status;
if (resultStatus != 'OK') {
return callback(new Error('Result error: ' + resultStatus));
}
- var element = data.rows[0].elements[0];
var results = {
index: options.index,
distance: element.distance.text,

0 comments on commit 66d4dbb

Please sign in to comment.