get-lat-long 1.0.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.
Files changed (4) hide show
  1. package/.nvmrc +1 -0
  2. package/README.md +2 -0
  3. package/index.js +13 -0
  4. package/package.json +17 -0
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v19.4.0
package/README.md ADDED
@@ -0,0 +1,2 @@
1
+ #get-lat-long
2
+
package/index.js ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ 'use strict'
3
+
4
+ // const args = process.argv.slice(2)
5
+ // if (args.length < 1 || args.length > 1) {
6
+ // console.error('Invalid params provided')
7
+ // process.exit(1)
8
+ // }
9
+
10
+ import fetch from 'node-fetch'
11
+ const { loc } = await(await fetch('http://ipinfo.io/json')).json()
12
+ const [latitude, longitude] = loc.split(',')
13
+ console.log({ latitude, longitude });
package/package.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "get-lat-long",
3
+ "version": "1.0.0",
4
+ "description": "displays current location",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "bin": "index.js",
8
+ "scripts": {
9
+ "start": "node ."
10
+ },
11
+ "keywords": [],
12
+ "author": "Athithyan R",
13
+ "license": "ISC",
14
+ "dependencies": {
15
+ "node-fetch": "^3.3.0"
16
+ }
17
+ }