@k03mad/ip2geo 4.0.0 → 4.1.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 +4 -1
- package/app/cli.js +4 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
npm i @k03mad/ip2geo -g
|
|
10
10
|
ip2geo --help
|
|
11
11
|
|
|
12
|
+
ip2geo
|
|
13
|
+
# your IP info
|
|
14
|
+
|
|
12
15
|
ip2geo 1.1.1.1
|
|
13
16
|
# {
|
|
14
17
|
# ip: '1.1.1.1',
|
|
@@ -42,7 +45,7 @@ const info = await ip2geo('1.1.1.1', {
|
|
|
42
45
|
cacheFileSeparator: ';;',
|
|
43
46
|
cacheFileNewline: '\n',
|
|
44
47
|
cacheMap: new Map(),
|
|
45
|
-
rps: 5, // useful in Promise.all with
|
|
48
|
+
rps: 5, // useful in Promise.all with IPs array
|
|
46
49
|
});
|
|
47
50
|
|
|
48
51
|
// info {
|
package/app/cli.js
CHANGED
|
@@ -7,6 +7,7 @@ import {codeText, nameText} from './helpers/colors.js';
|
|
|
7
7
|
import {ip2geo} from './index.js';
|
|
8
8
|
|
|
9
9
|
const args = process.argv.slice(2);
|
|
10
|
+
const argsIps = args.filter(arg => !arg.startsWith('-'));
|
|
10
11
|
|
|
11
12
|
if (args.includes('-h') || args.includes('--help')) {
|
|
12
13
|
const prefix = codeText('$');
|
|
@@ -26,9 +27,9 @@ if (args.includes('-h') || args.includes('--help')) {
|
|
|
26
27
|
]);
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
const output =
|
|
30
|
-
|
|
31
|
-
.map(arg => Promise.all(arg.split(',').map(
|
|
30
|
+
const output = argsIps.length === 0
|
|
31
|
+
? [await ip2geo()]
|
|
32
|
+
: await Promise.all(argsIps.map(arg => Promise.all(arg.split(',').map(ip => ip2geo(ip)))));
|
|
32
33
|
|
|
33
34
|
const flatten = output.flat();
|
|
34
35
|
|