|
@@ -19,8 +19,8 @@ class ToGeohash extends Operation {
|
|
|
super();
|
|
|
|
|
|
this.name = "To Geohash";
|
|
|
- this.module = "Default";
|
|
|
- this.description = "Converts Lat / Long coordinates into a Geohash string. For example, <code>37.8324,112.5584</code> becomes <code>ww8p1r4t8</code>.";
|
|
|
+ this.module = "Hashing";
|
|
|
+ this.description = "Converts Lat/Long coordinates into a Geohash string. For example, <code>37.8324,112.5584</code> becomes <code>ww8p1r4t8</code>.";
|
|
|
this.infoURL = "https://wikipedia.org/wiki/Geohash";
|
|
|
this.inputType = "string";
|
|
|
this.outputType = "string";
|
|
@@ -41,9 +41,11 @@ class ToGeohash extends Operation {
|
|
|
run(input, args) {
|
|
|
const [precision] = args;
|
|
|
|
|
|
- input = input.replace(/ /g, "");
|
|
|
- if (input === "") return "";
|
|
|
- return geohash.encode(...input.split(",").map(num => parseFloat(num)), precision);
|
|
|
+ return input.split("\n").map(line => {
|
|
|
+ line = line.replace(/ /g, "");
|
|
|
+ if (line === "") return "";
|
|
|
+ return geohash.encode(...line.split(",").map(num => parseFloat(num)), precision);
|
|
|
+ }).join("\n");
|
|
|
}
|
|
|
|
|
|
}
|