@adamlui/geolocate 2.0.0 → 2.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/README.md +13 -11
- package/docs/README.md +13 -11
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
### Fetch IP geolocation data from the CLI.
|
|
4
4
|
|
|
5
|
-
<a href="https://github.com/adamlui/js-utils/releases/tag/geolocate-2.0.
|
|
5
|
+
<a href="https://github.com/adamlui/js-utils/releases/tag/geolocate-2.0.1"><img height=31 src="https://img.shields.io/badge/Latest_Build-2.0.1-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
6
6
|
<a href="https://www.npmjs.com/package/@adamlui/geolocate?activeTab=code"><img height=31 src="https://img.shields.io/npm/unpacked-size/%40adamlui%2Fgeolocate?style=for-the-badge&logo=ebox&logoColor=white&labelColor=464646&color=blue"></a>
|
|
7
|
-
<a href="https://github.com/adamlui/js-utils/blob/geolocate-2.0.
|
|
7
|
+
<a href="https://github.com/adamlui/js-utils/blob/geolocate-2.0.1/geolocate/dist/geolocate.min.js"><img height=31 src="https://img.shields.io/github/size/adamlui/js-utils/geolocate/dist/geolocate.min.js?branch=geolocate-2.0.1&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
|
|
8
8
|
<a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_js-utils:geolocate/src/geolocate.js"><img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_js-utils%3Ageolocate%2Fsrc%2Fgeolocate.js%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonarcloud&logoColor=white&labelColor=464646&label=Vulnerabilities&color=gold"></a>
|
|
9
9
|
|
|
10
10
|
<br>
|
|
@@ -47,7 +47,7 @@ Sample output:
|
|
|
47
47
|
|
|
48
48
|
<img src="https://github.com/adamlui/js-utils/blob/main/geolocate/media/images/screenshots/cli-geolocate-8.8.8.8.jpg">
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
**📝 Note:** If no IPv4 address is passed, your own one will be used.
|
|
51
51
|
|
|
52
52
|
### Command line options
|
|
53
53
|
|
|
@@ -89,14 +89,14 @@ const geo = require('@adamlui/geolocate');
|
|
|
89
89
|
#### <> HTML script tag:
|
|
90
90
|
|
|
91
91
|
```html
|
|
92
|
-
<script src="https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.
|
|
92
|
+
<script src="https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.1/dist/geolocate.min.js"></script>
|
|
93
93
|
```
|
|
94
94
|
|
|
95
95
|
#### ES6:
|
|
96
96
|
|
|
97
97
|
```js
|
|
98
98
|
(async () => {
|
|
99
|
-
await import('https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.
|
|
99
|
+
await import('https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.1/dist/geolocate.min.js');
|
|
100
100
|
// Your code here...
|
|
101
101
|
})();
|
|
102
102
|
```
|
|
@@ -105,7 +105,7 @@ const geo = require('@adamlui/geolocate');
|
|
|
105
105
|
|
|
106
106
|
```js
|
|
107
107
|
...
|
|
108
|
-
// @require https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.
|
|
108
|
+
// @require https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.1/dist/geolocate.min.js
|
|
109
109
|
// ==/UserScript==
|
|
110
110
|
|
|
111
111
|
// Your code here...
|
|
@@ -113,7 +113,7 @@ const geo = require('@adamlui/geolocate');
|
|
|
113
113
|
|
|
114
114
|
<br>
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
**📝 Note:** To always import the latest version (not recommended in production!) remove the `@2.0.1` version tag from the jsDelivr URL: `https://cdn.jsdelivr.net/npm/@adamlui/geolocate/dist/geolocate.min.js`
|
|
117
117
|
|
|
118
118
|
<br>
|
|
119
119
|
|
|
@@ -123,7 +123,9 @@ const geo = require('@adamlui/geolocate');
|
|
|
123
123
|
|
|
124
124
|
### `locate([ips, options])`
|
|
125
125
|
|
|
126
|
-
Asynchronous method to fetch geolocation data for each `ip` passed in an array, returned as an array of data objects
|
|
126
|
+
💡 Asynchronous method to fetch geolocation data for each `ip` passed in an array, returned as an array of data objects.
|
|
127
|
+
|
|
128
|
+
Example:
|
|
127
129
|
|
|
128
130
|
```js
|
|
129
131
|
// Using await syntax
|
|
@@ -138,7 +140,7 @@ geo.locate('8.8.8.8').then(location => {
|
|
|
138
140
|
});
|
|
139
141
|
|
|
140
142
|
/* outputs:
|
|
141
|
-
{
|
|
143
|
+
[{
|
|
142
144
|
ip: '8.8.8.8',
|
|
143
145
|
country: 'United States',
|
|
144
146
|
countryCode: 'US',
|
|
@@ -150,11 +152,11 @@ geo.locate('8.8.8.8').then(location => {
|
|
|
150
152
|
lon: -77.5,
|
|
151
153
|
timezone: 'America/New_York',
|
|
152
154
|
isp: 'Google LLC'
|
|
153
|
-
}
|
|
155
|
+
}]
|
|
154
156
|
*/
|
|
155
157
|
```
|
|
156
158
|
|
|
157
|
-
|
|
159
|
+
**📝 Note:** If no IPv4 address is passed, your own one will be used.
|
|
158
160
|
|
|
159
161
|
Available options (passed as object properties):
|
|
160
162
|
|
package/docs/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
### Fetch IP geolocation data from the CLI.
|
|
4
4
|
|
|
5
|
-
<a href="https://github.com/adamlui/js-utils/releases/tag/geolocate-2.0.
|
|
5
|
+
<a href="https://github.com/adamlui/js-utils/releases/tag/geolocate-2.0.1"><img height=31 src="https://img.shields.io/badge/Latest_Build-2.0.1-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
6
6
|
<a href="https://www.npmjs.com/package/@adamlui/geolocate?activeTab=code"><img height=31 src="https://img.shields.io/npm/unpacked-size/%40adamlui%2Fgeolocate?style=for-the-badge&logo=ebox&logoColor=white&labelColor=464646&color=blue"></a>
|
|
7
|
-
<a href="https://github.com/adamlui/js-utils/blob/geolocate-2.0.
|
|
7
|
+
<a href="https://github.com/adamlui/js-utils/blob/geolocate-2.0.1/geolocate/dist/geolocate.min.js"><img height=31 src="https://img.shields.io/github/size/adamlui/js-utils/geolocate/dist/geolocate.min.js?branch=geolocate-2.0.1&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
|
|
8
8
|
<a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_js-utils:geolocate/src/geolocate.js"><img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_js-utils%3Ageolocate%2Fsrc%2Fgeolocate.js%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonarcloud&logoColor=white&labelColor=464646&label=Vulnerabilities&color=gold"></a>
|
|
9
9
|
|
|
10
10
|
<br>
|
|
@@ -47,7 +47,7 @@ Sample output:
|
|
|
47
47
|
|
|
48
48
|
<img src="https://github.com/adamlui/js-utils/blob/main/geolocate/media/images/screenshots/cli-geolocate-8.8.8.8.jpg">
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
**📝 Note:** If no IPv4 address is passed, your own one will be used.
|
|
51
51
|
|
|
52
52
|
### Command line options
|
|
53
53
|
|
|
@@ -89,14 +89,14 @@ const geo = require('@adamlui/geolocate');
|
|
|
89
89
|
#### <> HTML script tag:
|
|
90
90
|
|
|
91
91
|
```html
|
|
92
|
-
<script src="https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.
|
|
92
|
+
<script src="https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.1/dist/geolocate.min.js"></script>
|
|
93
93
|
```
|
|
94
94
|
|
|
95
95
|
#### ES6:
|
|
96
96
|
|
|
97
97
|
```js
|
|
98
98
|
(async () => {
|
|
99
|
-
await import('https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.
|
|
99
|
+
await import('https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.1/dist/geolocate.min.js');
|
|
100
100
|
// Your code here...
|
|
101
101
|
})();
|
|
102
102
|
```
|
|
@@ -105,7 +105,7 @@ const geo = require('@adamlui/geolocate');
|
|
|
105
105
|
|
|
106
106
|
```js
|
|
107
107
|
...
|
|
108
|
-
// @require https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.
|
|
108
|
+
// @require https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.1/dist/geolocate.min.js
|
|
109
109
|
// ==/UserScript==
|
|
110
110
|
|
|
111
111
|
// Your code here...
|
|
@@ -113,7 +113,7 @@ const geo = require('@adamlui/geolocate');
|
|
|
113
113
|
|
|
114
114
|
<br>
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
**📝 Note:** To always import the latest version (not recommended in production!) remove the `@2.0.1` version tag from the jsDelivr URL: `https://cdn.jsdelivr.net/npm/@adamlui/geolocate/dist/geolocate.min.js`
|
|
117
117
|
|
|
118
118
|
<br>
|
|
119
119
|
|
|
@@ -123,7 +123,9 @@ const geo = require('@adamlui/geolocate');
|
|
|
123
123
|
|
|
124
124
|
### `locate([ips, options])`
|
|
125
125
|
|
|
126
|
-
Asynchronous method to fetch geolocation data for each `ip` passed in an array, returned as an array of data objects
|
|
126
|
+
💡 Asynchronous method to fetch geolocation data for each `ip` passed in an array, returned as an array of data objects.
|
|
127
|
+
|
|
128
|
+
Example:
|
|
127
129
|
|
|
128
130
|
```js
|
|
129
131
|
// Using await syntax
|
|
@@ -138,7 +140,7 @@ geo.locate('8.8.8.8').then(location => {
|
|
|
138
140
|
});
|
|
139
141
|
|
|
140
142
|
/* outputs:
|
|
141
|
-
{
|
|
143
|
+
[{
|
|
142
144
|
ip: '8.8.8.8',
|
|
143
145
|
country: 'United States',
|
|
144
146
|
countryCode: 'US',
|
|
@@ -150,11 +152,11 @@ geo.locate('8.8.8.8').then(location => {
|
|
|
150
152
|
lon: -77.5,
|
|
151
153
|
timezone: 'America/New_York',
|
|
152
154
|
isp: 'Google LLC'
|
|
153
|
-
}
|
|
155
|
+
}]
|
|
154
156
|
*/
|
|
155
157
|
```
|
|
156
158
|
|
|
157
|
-
|
|
159
|
+
**📝 Note:** If no IPv4 address is passed, your own one will be used.
|
|
158
160
|
|
|
159
161
|
Available options (passed as object properties):
|
|
160
162
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adamlui/geolocate",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Fetch IP geolocation data from the CLI.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Adam Lui",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"url": "https://github.com/adamlui/js-utils/issues"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"generate-ip": "^2.2.
|
|
50
|
+
"generate-ip": "^2.2.6"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@adamlui/minify.js": "^1.5.
|
|
53
|
+
"@adamlui/minify.js": "^1.5.4"
|
|
54
54
|
}
|
|
55
55
|
}
|