geo-coordinates-parser 1.6.4 → 1.6.6
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/converter.d.ts +11 -3
- package/dist/cjs/converter.js +2 -2
- package/dist/cjs/tests/testIndividual.js +1 -1
- package/dist/cjs/toCoordinateFormat.d.ts +3 -2
- package/dist/cjs/toCoordinateFormat.js +2 -1
- package/dist/mjs/converter.d.ts +11 -3
- package/dist/mjs/converter.js +2 -2
- package/dist/mjs/tests/testIndividual.js +1 -1
- package/dist/mjs/toCoordinateFormat.d.ts +3 -2
- package/dist/mjs/toCoordinateFormat.js +2 -1
- package/package.json +1 -1
package/dist/cjs/converter.d.ts
CHANGED
@@ -2,13 +2,21 @@ export default converter;
|
|
2
2
|
/**
|
3
3
|
* Function for converting coordinates in a variety of formats to decimal coordinates
|
4
4
|
* @param {string} coordsString The coordinates string to convert
|
5
|
-
* @param {number} decimalPlaces The number of decimal places for converted coordinates; default is 5
|
6
|
-
* @returns {
|
5
|
+
* @param {number} [decimalPlaces] The number of decimal places for converted coordinates; default is 5
|
6
|
+
* @returns {{verbatimCoordinates: string, decimalCoordinates: string, decimalLatitude: string, decimalLongitude: string, closeEnough: function(string): boolean, toCoordinateFormat: toCoordinateFormat}}
|
7
7
|
*/
|
8
|
-
declare function converter(coordsString: string, decimalPlaces
|
8
|
+
declare function converter(coordsString: string, decimalPlaces?: number | undefined): {
|
9
|
+
verbatimCoordinates: string;
|
10
|
+
decimalCoordinates: string;
|
11
|
+
decimalLatitude: string;
|
12
|
+
decimalLongitude: string;
|
13
|
+
closeEnough: (arg0: string) => boolean;
|
14
|
+
toCoordinateFormat: typeof toCoordinateFormat;
|
15
|
+
};
|
9
16
|
declare namespace converter {
|
10
17
|
export { to };
|
11
18
|
}
|
19
|
+
import toCoordinateFormat from './toCoordinateFormat.js';
|
12
20
|
declare const to: Readonly<{
|
13
21
|
DMS: "DMS";
|
14
22
|
DM: "DM";
|
package/dist/cjs/converter.js
CHANGED
@@ -10,8 +10,8 @@ const toCoordinateFormat_js_1 = __importDefault(require("./toCoordinateFormat.js
|
|
10
10
|
/**
|
11
11
|
* Function for converting coordinates in a variety of formats to decimal coordinates
|
12
12
|
* @param {string} coordsString The coordinates string to convert
|
13
|
-
* @param {number} decimalPlaces The number of decimal places for converted coordinates; default is 5
|
14
|
-
* @returns {
|
13
|
+
* @param {number} [decimalPlaces] The number of decimal places for converted coordinates; default is 5
|
14
|
+
* @returns {{verbatimCoordinates: string, decimalCoordinates: string, decimalLatitude: string, decimalLongitude: string, closeEnough: function(string): boolean, toCoordinateFormat: toCoordinateFormat}}
|
15
15
|
*/
|
16
16
|
function converter(coordsString, decimalPlaces) {
|
17
17
|
//TODO add exact match to entered string, so that it can be used to filter out superflous text around it
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const converter_js_1 = __importDefault(require("../converter.js"));
|
7
7
|
//const test = '26°44S 29°46E'
|
8
8
|
//const test = '00.00, 01.00'
|
9
|
-
const test = `
|
9
|
+
const test = `26°05240'S, 27°51448'E`;
|
10
10
|
try {
|
11
11
|
let converted = (0, converter_js_1.default)(test);
|
12
12
|
console.log(converted);
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export default toCoordinateFormat;
|
2
2
|
/**
|
3
3
|
* Converts decimalCoordinates to other formats commonly used
|
4
|
-
* @param {
|
4
|
+
* @param {string} format Either DMS or DM
|
5
|
+
* @returns {string}
|
5
6
|
*/
|
6
|
-
declare function toCoordinateFormat(format:
|
7
|
+
declare function toCoordinateFormat(format: string): string;
|
@@ -3,7 +3,8 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
4
|
/**
|
5
5
|
* Converts decimalCoordinates to other formats commonly used
|
6
|
-
* @param {
|
6
|
+
* @param {string} format Either DMS or DM
|
7
|
+
* @returns {string}
|
7
8
|
*/
|
8
9
|
function toCoordinateFormat(format) {
|
9
10
|
if (!['DMS', 'DM', 'DD'].includes(format))
|
package/dist/mjs/converter.d.ts
CHANGED
@@ -2,13 +2,21 @@ export default converter;
|
|
2
2
|
/**
|
3
3
|
* Function for converting coordinates in a variety of formats to decimal coordinates
|
4
4
|
* @param {string} coordsString The coordinates string to convert
|
5
|
-
* @param {number} decimalPlaces The number of decimal places for converted coordinates; default is 5
|
6
|
-
* @returns {
|
5
|
+
* @param {number} [decimalPlaces] The number of decimal places for converted coordinates; default is 5
|
6
|
+
* @returns {{verbatimCoordinates: string, decimalCoordinates: string, decimalLatitude: string, decimalLongitude: string, closeEnough: function(string): boolean, toCoordinateFormat: toCoordinateFormat}}
|
7
7
|
*/
|
8
|
-
declare function converter(coordsString: string, decimalPlaces
|
8
|
+
declare function converter(coordsString: string, decimalPlaces?: number | undefined): {
|
9
|
+
verbatimCoordinates: string;
|
10
|
+
decimalCoordinates: string;
|
11
|
+
decimalLatitude: string;
|
12
|
+
decimalLongitude: string;
|
13
|
+
closeEnough: (arg0: string) => boolean;
|
14
|
+
toCoordinateFormat: typeof toCoordinateFormat;
|
15
|
+
};
|
9
16
|
declare namespace converter {
|
10
17
|
export { to };
|
11
18
|
}
|
19
|
+
import toCoordinateFormat from './toCoordinateFormat.js';
|
12
20
|
declare const to: Readonly<{
|
13
21
|
DMS: "DMS";
|
14
22
|
DM: "DM";
|
package/dist/mjs/converter.js
CHANGED
@@ -5,8 +5,8 @@ import toCoordinateFormat from './toCoordinateFormat.js';
|
|
5
5
|
/**
|
6
6
|
* Function for converting coordinates in a variety of formats to decimal coordinates
|
7
7
|
* @param {string} coordsString The coordinates string to convert
|
8
|
-
* @param {number} decimalPlaces The number of decimal places for converted coordinates; default is 5
|
9
|
-
* @returns {
|
8
|
+
* @param {number} [decimalPlaces] The number of decimal places for converted coordinates; default is 5
|
9
|
+
* @returns {{verbatimCoordinates: string, decimalCoordinates: string, decimalLatitude: string, decimalLongitude: string, closeEnough: function(string): boolean, toCoordinateFormat: toCoordinateFormat}}
|
10
10
|
*/
|
11
11
|
function converter(coordsString, decimalPlaces) {
|
12
12
|
//TODO add exact match to entered string, so that it can be used to filter out superflous text around it
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export default toCoordinateFormat;
|
2
2
|
/**
|
3
3
|
* Converts decimalCoordinates to other formats commonly used
|
4
|
-
* @param {
|
4
|
+
* @param {string} format Either DMS or DM
|
5
|
+
* @returns {string}
|
5
6
|
*/
|
6
|
-
declare function toCoordinateFormat(format:
|
7
|
+
declare function toCoordinateFormat(format: string): string;
|
@@ -1,7 +1,8 @@
|
|
1
1
|
//borrowed from https://www.codegrepper.com/code-examples/javascript/javascript+converting+latitude+longitude+to+gps+coordinates
|
2
2
|
/**
|
3
3
|
* Converts decimalCoordinates to other formats commonly used
|
4
|
-
* @param {
|
4
|
+
* @param {string} format Either DMS or DM
|
5
|
+
* @returns {string}
|
5
6
|
*/
|
6
7
|
function toCoordinateFormat(format) {
|
7
8
|
if (!['DMS', 'DM', 'DD'].includes(format))
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "geo-coordinates-parser",
|
3
|
-
"version": "1.6.
|
3
|
+
"version": "1.6.6",
|
4
4
|
"description": "A Javascript function for reading a variety of coordinate formats and converting to decimal numbers. Builds on other efforts by returning the verbatim coordinates and the decimal coordinates all in one object.",
|
5
5
|
"type": "module",
|
6
6
|
"main": "./dist/cjs/merge.js",
|