This commit is contained in:
John Firebaugh 2013-12-09 14:17:51 -05:00
parent 3bf94673da
commit 9af6cd3df9
2 changed files with 8 additions and 2 deletions

View File

@ -9,14 +9,19 @@
},
"dependencies": {},
"devDependencies": {
"jshint": "2.3.0",
"mocha": "1.2.x"
},
"optionalDependencies": {},
"scripts": {
"test": "mocha -R spec"
"test": "jshint src && mocha -R spec"
},
"main": "src/polyline.js",
"engines": {
"node": "*"
},
"jshintConfig": {
"undef": true,
"node": true
}
}

View File

@ -22,9 +22,10 @@ polyline.encodeCoordinate = function(coordinate) {
// See http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/decode.js
polyline.decodeCoordinate = function(str) {
var result = 0, shift = 0;
for (var i = 0; i < str.length; i++) {
var binary = str.charCodeAt(i) - 63;
result |= (b & 0x1f) << shift;
result |= (binary & 0x1f) << shift;
shift += 5;
}
};