get-lat-long 0.0.1
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/.nvmrc +1 -0
- package/README.md +13 -0
- package/data/data.json +1 -0
- package/lib/index.js +20 -0
- package/package.json +23 -0
- package/src/index.js +12 -0
package/lib/index.js
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env -S node --experimental-vm-modules
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
5
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
6
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
8
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
9
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
10
|
+
var args = process.argv.slice(2);
|
11
|
+
if (args.length < 1 || args.length > 1) {
|
12
|
+
console.error('Invalid params provided');
|
13
|
+
process.exit(1);
|
14
|
+
}
|
15
|
+
var _args = _slicedToArray(args, 1),
|
16
|
+
city = _args[0];
|
17
|
+
var data = require('../data/data.json');
|
18
|
+
console.log(data.find(function (obj) {
|
19
|
+
return obj.city_ls.includes(city);
|
20
|
+
}) || 'No matches found');
|
package/package.json
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"name": "get-lat-long",
|
3
|
+
"version": "0.0.1",
|
4
|
+
"description": "displays current location",
|
5
|
+
"main": "src/index.js",
|
6
|
+
"bin": "lib/index.js",
|
7
|
+
"scripts": {
|
8
|
+
"prepublish": "babel src --out-dir lib"
|
9
|
+
},
|
10
|
+
"babel": {
|
11
|
+
"presets": [
|
12
|
+
"@babel/preset-env"
|
13
|
+
]
|
14
|
+
},
|
15
|
+
"keywords": [],
|
16
|
+
"author": "Athithyan R",
|
17
|
+
"license": "ISC",
|
18
|
+
"devDependencies": {
|
19
|
+
"@babel/cli": "^7.20.7",
|
20
|
+
"@babel/core": "^7.20.12",
|
21
|
+
"@babel/preset-env": "^7.20.2"
|
22
|
+
}
|
23
|
+
}
|
package/src/index.js
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env -S node --experimental-vm-modules
|
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
|
+
const [city] = args;
|
10
|
+
|
11
|
+
const data = require('../data/data.json')
|
12
|
+
console.log(data.find((obj) => obj.city_ls.includes(city)) || 'No matches found')
|