[mgrs] 03/06: Imported Upstream version 0.0.1

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Thu Feb 26 18:25:19 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository mgrs.

commit a56bcabd11c8f6b5cffd4d0206af08d717bce711
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Thu Feb 26 19:09:01 2015 +0100

    Imported Upstream version 0.0.1
---
 .gitignore              |  1 -
 mgrs.js => dist/mgrs.js | 16 +++++++++++++---
 mgrs.js                 | 12 +++++++++---
 package.json            | 11 ++++++-----
 4 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/.gitignore b/.gitignore
index 0df0b9d..8226f2b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,3 @@
 node_modules
 .DS_STORE
 coverage
-dist
\ No newline at end of file
diff --git a/mgrs.js b/dist/mgrs.js
similarity index 94%
copy from mgrs.js
copy to dist/mgrs.js
index 3e5f8d8..2e1ada5 100644
--- a/mgrs.js
+++ b/dist/mgrs.js
@@ -1,3 +1,4 @@
+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.mgrs=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find  [...]
 
 
 
@@ -58,12 +59,18 @@ exports.forward = function(ll, accuracy) {
  */
 exports.inverse = function(mgrs) {
   var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
+  if (bbox.lat && bbox.lon) {
+    return [bbox.lon, bbox.lat, bbox.lon, bbox.lat];
+  }
   return [bbox.left, bbox.bottom, bbox.right, bbox.top];
 };
 
-exports.toPoint = function(mgrsStr) {
-  var llbbox = exports.inverse(mgrsStr);
-  return [(llbbox[2] + llbbox[0]) / 2, (llbbox[3] + llbbox[1]) / 2];
+exports.toPoint = function(mgrs) {
+  var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
+  if (bbox.lat && bbox.lon) {
+    return [bbox.lon, bbox.lat];
+  }
+  return [(bbox.left + bbox.right) / 2, (bbox.top + bbox.bottom) / 2];
 };
 /**
  * Conversion from degrees to radians.
@@ -733,3 +740,6 @@ function getMinNorthing(zoneLetter) {
   }
 
 }
+
+},{}]},{},[1])(1)
+});
diff --git a/mgrs.js b/mgrs.js
index 3e5f8d8..95ad313 100644
--- a/mgrs.js
+++ b/mgrs.js
@@ -58,12 +58,18 @@ exports.forward = function(ll, accuracy) {
  */
 exports.inverse = function(mgrs) {
   var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
+  if (bbox.lat && bbox.lon) {
+    return [bbox.lon, bbox.lat, bbox.lon, bbox.lat];
+  }
   return [bbox.left, bbox.bottom, bbox.right, bbox.top];
 };
 
-exports.toPoint = function(mgrsStr) {
-  var llbbox = exports.inverse(mgrsStr);
-  return [(llbbox[2] + llbbox[0]) / 2, (llbbox[3] + llbbox[1]) / 2];
+exports.toPoint = function(mgrs) {
+  var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
+  if (bbox.lat && bbox.lon) {
+    return [bbox.lon, bbox.lat];
+  }
+  return [(bbox.left + bbox.right) / 2, (bbox.top + bbox.bottom) / 2];
 };
 /**
  * Conversion from degrees to radians.
diff --git a/package.json b/package.json
index a966c4f..22e5a3e 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,11 @@
 {
   "name": "mgrs",
-  "version": "0.0.0",
+  "version": "0.0.1",
   "description": "Utility for converting between WGS84 lat/lng and MGRS coordinates",
   "main": "mgrs.js",
   "scripts": {
     "test": "./node_modules/istanbul/lib/cli.js test ./node_modules/mocha/bin/_mocha test/test.js",
-    "build":"mkdir -p dist && browserify mgrs.js -s mgrs -o dist/mgrs.js"
+    "build": "mkdir -p dist && browserify mgrs.js -s mgrs | derequire > dist/mgrs.js"
   },
   "repository": {
     "type": "git",
@@ -22,9 +22,10 @@
     "url": "https://github.com/proj4js/mgrs/issues"
   },
   "devDependencies": {
-    "mocha": "~1.15.1",
+    "browserify": "^8.1.1",
+    "chai": "~1.8.1",
+    "derequire": "^1.2.0",
     "istanbul": "~0.1.46",
-    "browserify": "~2.36.1",
-    "chai": "~1.8.1"
+    "mocha": "~1.15.1"
   }
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/mgrs.git



More information about the Pkg-grass-devel mailing list