@mailwoman/timezone-lookup 5.9.0 → 5.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/out/cli.d.ts +6 -2
- package/out/cli.d.ts.map +1 -1
- package/out/cli.js +20 -29
- package/out/cli.js.map +1 -1
- package/package.json +21 -4
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ npx @mailwoman/timezone-lookup build --geojson combined-with-oceans.json --out t
|
|
|
15
15
|
## Look up
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
npx @mailwoman/timezone-lookup --db timezone.db 40.7128 -74.0060
|
|
18
|
+
npx @mailwoman/timezone-lookup --db timezone.db -- 40.7128 -74.0060
|
|
19
19
|
# {"timezone":"America/New_York","offsetSec":-18000}
|
|
20
20
|
```
|
|
21
21
|
|
package/out/cli.d.ts
CHANGED
|
@@ -6,8 +6,12 @@
|
|
|
6
6
|
*
|
|
7
7
|
* `mailwoman-timezone` — build the polygon DB, or look up a coordinate's IANA timezone.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
* --
|
|
9
|
+
* ```sh
|
|
10
|
+
* mailwoman-timezone build --geojson combined-with-oceans.json --out timezone.db
|
|
11
|
+
* mailwoman-timezone --db timezone.db -- 40.7128 -74.0060
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* The `--` separates flags from coordinates so negative longitudes parse as positionals.
|
|
11
15
|
*/
|
|
12
16
|
export {};
|
|
13
17
|
//# sourceMappingURL=cli.d.ts.map
|
package/out/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;GAaG"}
|
package/out/cli.js
CHANGED
|
@@ -6,19 +6,25 @@
|
|
|
6
6
|
*
|
|
7
7
|
* `mailwoman-timezone` — build the polygon DB, or look up a coordinate's IANA timezone.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
* --
|
|
9
|
+
* ```sh
|
|
10
|
+
* mailwoman-timezone build --geojson combined-with-oceans.json --out timezone.db
|
|
11
|
+
* mailwoman-timezone --db timezone.db -- 40.7128 -74.0060
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* The `--` separates flags from coordinates so negative longitudes parse as positionals.
|
|
11
15
|
*/
|
|
12
16
|
import { parseArgs } from "node:util";
|
|
13
|
-
import { cliArguments } from "@mailwoman/core/utils";
|
|
14
17
|
import { buildTimezoneDB } from "./build.js";
|
|
15
18
|
import { offsetSecForTimezone, TimezoneLookup } from "./index.js";
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
19
|
+
const { values, positionals } = parseArgs({
|
|
20
|
+
options: {
|
|
21
|
+
geojson: { type: "string" },
|
|
22
|
+
out: { type: "string" },
|
|
23
|
+
db: { type: "string" },
|
|
24
|
+
},
|
|
25
|
+
allowPositionals: true,
|
|
26
|
+
});
|
|
27
|
+
if (positionals[0] === "build") {
|
|
22
28
|
if (!values.geojson || !values.out) {
|
|
23
29
|
console.error("Usage: mailwoman-timezone build --geojson <path> --out <db>");
|
|
24
30
|
process.exit(1);
|
|
@@ -27,28 +33,13 @@ if (argvAll[0] === "build") {
|
|
|
27
33
|
console.error(`built ${values.out} (${features} features)`);
|
|
28
34
|
}
|
|
29
35
|
else {
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
for (let i = 0; i < args.length; i++) {
|
|
35
|
-
if (args[i] === "--db") {
|
|
36
|
-
databasePath = args[++i];
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
const n = Number(args[i]);
|
|
40
|
-
if (Number.isFinite(n)) {
|
|
41
|
-
coords.push(n);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const lat = coords[0];
|
|
46
|
-
const lon = coords[1];
|
|
47
|
-
if (!databasePath || lat == null || lon == null) {
|
|
48
|
-
console.error("Usage: mailwoman-timezone --db <db> <lat> <lon>");
|
|
36
|
+
const lat = Number(positionals[0]);
|
|
37
|
+
const lon = Number(positionals[1]);
|
|
38
|
+
if (!values.db || !Number.isFinite(lat) || !Number.isFinite(lon)) {
|
|
39
|
+
console.error("Usage: mailwoman-timezone --db <db> -- <lat> <lon>");
|
|
49
40
|
process.exit(1);
|
|
50
41
|
}
|
|
51
|
-
const lookup = new TimezoneLookup({ databasePath });
|
|
42
|
+
const lookup = new TimezoneLookup({ databasePath: values.db });
|
|
52
43
|
const tzid = lookup.find(lat, lon);
|
|
53
44
|
console.log(JSON.stringify({ timezone: tzid, offsetSec: tzid ? offsetSecForTimezone(tzid) : null }));
|
|
54
45
|
lookup.close();
|
package/out/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEjE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC;IACzC,OAAO,EAAE;QACR,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACvB,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KACtB;IACD,gBAAgB,EAAE,IAAI;CACtB,CAA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AAC,CAAA;IACpG,MAAM,CAAC,KAAK,EAAE,CAAA;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/timezone-lookup",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.10.0",
|
|
4
4
|
"description": "Coordinate → IANA timezone, server-side. Point-in-polygon over timezone-boundary-builder polygons in a node:sqlite DB; UTC offset via Intl (no tz-db dependency). An @mailwoman/annotations Annotator.",
|
|
5
5
|
"license": "AGPL-3.0-only OR LicenseRef-Commercial",
|
|
6
6
|
"repository": {
|
|
@@ -19,13 +19,30 @@
|
|
|
19
19
|
"type": "module",
|
|
20
20
|
"exports": {
|
|
21
21
|
"./package.json": "./package.json",
|
|
22
|
-
".":
|
|
23
|
-
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./out/index.d.ts",
|
|
24
|
+
"default": "./out/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./build": {
|
|
27
|
+
"types": "./out/build.d.ts",
|
|
28
|
+
"default": "./out/build.js"
|
|
29
|
+
}
|
|
24
30
|
},
|
|
25
31
|
"publishConfig": {
|
|
32
|
+
"exports": {
|
|
33
|
+
"./package.json": "./package.json",
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./out/index.d.ts",
|
|
36
|
+
"default": "./out/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./build": {
|
|
39
|
+
"types": "./out/build.d.ts",
|
|
40
|
+
"default": "./out/build.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
26
43
|
"access": "public"
|
|
27
44
|
},
|
|
28
45
|
"dependencies": {
|
|
29
|
-
"@mailwoman/annotations": "5.
|
|
46
|
+
"@mailwoman/annotations": "5.10.0"
|
|
30
47
|
}
|
|
31
48
|
}
|