Skip to content

Commit

Permalink
Check existing cache in conversion functions
Browse files Browse the repository at this point in the history
  • Loading branch information
gilmoreorless committed Aug 31, 2011
1 parent b4ecb83 commit 5cb8721
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions geolib.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@
*/
decimal2sexagesimal: function(dec) {

if (dec in geolib.sexagesimal) {
return geolib.sexagesimal[dec];
}

var tmp = dec.toString().split('.');

var deg = tmp[0];
Expand All @@ -306,6 +310,10 @@
*/
sexagesimal2decimal: function(sexagesimal) {

if (sexagesimal in geolib.decimal) {
return geolib.decimal[sexagesimal];
}

var regEx = new RegExp(sexagesimalPattern);
var data = regEx.exec(sexagesimal);

Expand Down

0 comments on commit 5cb8721

Please sign in to comment.