@adamlui/geolocate 2.0.13 โ†’ 2.0.14

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 CHANGED
@@ -1,3 +1,5 @@
1
+ <a id="top"></a>
2
+
1
3
  # <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.geolocatejs.org/images/icons/wire-globe/white/icon32.png?0d36e26"><img height=28 src="https://media.geolocatejs.org/images/icons/wire-globe/black/icon32.png?0d36e26"></picture> geolocate
2
4
 
3
5
  ### Fetch IP geolocation data from the CLI.
@@ -5,17 +7,17 @@
5
7
  <a href="https://www.npmjs.com/package/@adamlui/geolocate">
6
8
  <img height=31 src="https://img.shields.io/npm/dm/@adamlui/geolocate?logo=npm&color=af68ff&logoColor=white&labelColor=464646&style=for-the-badge"></a>
7
9
  <a href="#%EF%B8%8F-mit-license">
8
- <img height=31 src="https://img.shields.io/badge/License-MIT-fc4f2d.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
9
- <a href="https://github.com/adamlui/js-utils/releases/tag/geolocate-2.0.13">
10
- <img height=31 src="https://img.shields.io/badge/Latest_Build-2.0.13-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
10
+ <img height=31 src="https://img.shields.io/badge/License-MIT-orange.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
11
+ <a href="https://github.com/adamlui/js-utils/releases/tag/geolocate-2.0.14">
12
+ <img height=31 src="https://img.shields.io/badge/Latest_Build-2.0.14-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
11
13
  <a href="https://www.npmjs.com/package/@adamlui/geolocate?activeTab=code">
12
14
  <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>
13
- <a href="https://github.com/adamlui/js-utils/blob/geolocate-2.0.13/geolocate/dist/geolocate.min.js">
14
- <img height=31 src="https://img.shields.io/github/size/adamlui/js-utils/geolocate/dist/geolocate.min.js?branch=geolocate-2.0.13&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
15
+ <a href="https://github.com/adamlui/js-utils/blob/geolocate-2.0.14/geolocate/dist/geolocate.min.js">
16
+ <img height=31 src="https://img.shields.io/github/size/adamlui/js-utils/geolocate/dist/geolocate.min.js?branch=geolocate-2.0.14&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
15
17
  <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_js-utils:geolocate/src/geolocate.js">
16
18
  <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>
17
19
  <a href="https://github.com/toolleeo/cli-apps#networking">
18
- <img height=31 src="https://img.shields.io/badge/Mentioned_in-Awesome-c4a2bd?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge"></a>
20
+ <img height=31 src="https://img.shields.io/badge/Mentioned_in-Awesome-ff69b4?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge"></a>
19
21
 
20
22
  <br>
21
23
 
@@ -91,7 +93,7 @@ import geo from '@adamlui/geolocate';
91
93
  #### CommonJS:
92
94
 
93
95
  ```js
94
- const geo = require('@adamlui/geolocate');
96
+ const geo = require('@adamlui/geolocate')
95
97
  ```
96
98
 
97
99
  ###### _*Node.js version 14 or higher required_
@@ -101,23 +103,23 @@ const geo = require('@adamlui/geolocate');
101
103
  #### <> HTML script tag:
102
104
 
103
105
  ```html
104
- <script src="https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.13/dist/geolocate.min.js"></script>
106
+ <script src="https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.14/dist/geolocate.min.js"></script>
105
107
  ```
106
108
 
107
109
  #### ES6:
108
110
 
109
111
  ```js
110
112
  (async () => {
111
- await import('https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.13/dist/geolocate.min.js');
113
+ await import('https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.14/dist/geolocate.min.js')
112
114
  // Your code here...
113
- })();
115
+ })()
114
116
  ```
115
117
 
116
118
  ### <img height=17 src="https://assets.js-utils.org/images/icons/platforms/tampermonkey/icon28.png?v=0d36e26"><img height=17.5 src="https://assets.js-utils.org/images/icons/platforms/violentmonkey/icon25.png?v=0d36e26"> Greasemonkey
117
119
 
118
120
  ```js
119
121
  ...
120
- // @require https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.13/dist/geolocate.min.js
122
+ // @require https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.14/dist/geolocate.min.js
121
123
  // ==/UserScript==
122
124
 
123
125
  // Your code here...
@@ -125,7 +127,7 @@ const geo = require('@adamlui/geolocate');
125
127
 
126
128
  <br>
127
129
 
128
- **๐Ÿ“ Note:** To always import the latest version (not recommended in production!) remove the `@2.0.13` version tag from the jsDelivr URL: `https://cdn.jsdelivr.net/npm/@adamlui/geolocate/dist/geolocate.min.js`
130
+ **๐Ÿ“ Note:** To always import the latest version (not recommended in production!) remove the `@2.0.14` version tag from the jsDelivr URL: `https://cdn.jsdelivr.net/npm/@adamlui/geolocate/dist/geolocate.min.js`
129
131
 
130
132
  <br>
131
133
 
@@ -140,18 +142,18 @@ const geo = require('@adamlui/geolocate');
140
142
  Example:
141
143
 
142
144
  ```js
143
- const geo = require('@adamlui/geolocate');
145
+ const geo = require('@adamlui/geolocate')
144
146
 
145
147
  // Using await syntax
146
148
  (async () => {
147
- const location = await geo.locate('8.8.8.8');
148
- console.log(location);
149
- })();
149
+ const location = await geo.locate('8.8.8.8')
150
+ console.log(location)
151
+ })()
150
152
 
151
153
  // Using .then() syntax
152
154
  geo.locate('8.8.8.8').then(location => {
153
- console.log(location);
154
- });
155
+ console.log(location)
156
+ })
155
157
 
156
158
  /* outputs:
157
159
  [{
@@ -222,4 +224,4 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
222
224
 
223
225
  <picture><source media="(prefers-color-scheme: dark)" srcset="https://assets.js-utils.org/images/icons/home/white/icon32x27.png?v=0d36e26"><img height=13 src="https://assets.js-utils.org/images/icons/home/dark-gray/icon32x27.png?v=0d36e26"></picture> <a href="https://js-utils.org">**More JavaScript utilities**</a> /
224
226
  <a href="https://github.com/adamlui/js-utils/discussions">Discuss</a> /
225
- <a href="#-geolocate">Back to top โ†‘</a>
227
+ <a href="#top">Back to top โ†‘</a>
package/dist/cli.min.js CHANGED
@@ -9,7 +9,7 @@
9
9
  * Source: https://code.geolocatejs.org
10
10
  * Documentation: https://docs.geolocatejs.org
11
11
  */
12
- let pkgName="@adamlui/geolocate",copyright="ยฉ 2024โ€“2026 Adam Lui under the MIT license.",cmdFormat="geolocate [ip1] [ip2] [...] [options|commands]",srcURL="https://code.geolocatejs.org",docURL="https://docs.geolocatejs.org/#-command-line-usage",latestLocaleCommitHash="0e30af1";(async()=>{let e=require(__dirname.match(/src/)?"./geolocate":"./geolocate.min"),n=require("fs"),s=require("path"),{execSync:i,execFileSync:o}=require("child_process"),r="",t="",l="en";if("win32"==process.platform)try{l=i("(Get-Culture).TwoLetterISOLanguageName",{shell:"powershell",encoding:"utf-8"}).trim()}catch(e){console.error("ERROR loading system language: "+e.message)}else{var a=process.env;l=(a.LANG||a.LANGUAGE||a.LC_ALL||a.LC_MESSAGES||a.LC_NAME||"en").split(".")[0]}let c={};var p,g,a=new Promise((i,r)=>{let t=`https://cdn.jsdelivr.net/gh/adamlui/js-utils@7d8e7e99b05705650c3d09401e0805b29c7e1822/geolocate/_locales/`,e=`${l?l.replace("-","_"):"en"}/`,a=t+e+"messages.json",c=0;v(a).then(async function o(n){try{let e=await n.json(),o={};for(var s in e)"object"==typeof e[s]&&"message"in e[s]&&(o[s]=e[s].message);i(o)}catch(e){if(3==++c)return i({});v(a=l.includes("-")&&1==c?a.replace(/([^_]*)_[^/]*(\/.*)/,"$1$2"):t+"en/messages.json").then(o).catch(r)}}).catch(r)});try{c=await a}catch(e){console.error("ERROR fetching messages: "+e.message)}let m={},f={flags:{quietMode:/^--?q(?:uiet)?(?:-?mode)?$/},infoCmds:{help:/^--?h(?:elp)?$/,version:/^--?ve?r?s?i?o?n?$/}};if(process.argv.forEach(o=>{var e,n;o.startsWith("-")&&(e=Object.keys(f.flags).find(e=>f.flags[e].test(o)),n=Object.keys(f.infoCmds).find(e=>f.infoCmds[e].test(o)),e?m[e]=!0:n||(console.error(`
12
+ let pkgName="@adamlui/geolocate",copyright="ยฉ 2024โ€“2026 Adam Lui under the MIT license.",cmdFormat="geolocate [ip1] [ip2] [...] [options|commands]",srcURL="https://code.geolocatejs.org",docURL="https://docs.geolocatejs.org/#-command-line-usage",latestLocaleCommitHash="0e30af1";(async()=>{let e=require(__dirname.match(/src/)?"./geolocate":"./geolocate.min"),n=require("fs"),s=require("path"),{execSync:i,execFileSync:o}=require("child_process"),r="",t="",l="en";if("win32"==process.platform)try{l=i("(Get-Culture).TwoLetterISOLanguageName",{shell:"powershell",encoding:"utf-8"}).trim()}catch(e){console.error("ERROR loading system language:",e.message)}else{var a=process.env;l=(a.LANG||a.LANGUAGE||a.LC_ALL||a.LC_MESSAGES||a.LC_NAME||"en").split(".")[0]}let c={};var p,g,a=new Promise((i,r)=>{let t=`https://cdn.jsdelivr.net/gh/adamlui/js-utils@dcec59086231fca1628052cb45339829b112c5ff/geolocate/_locales/`,e=`${l?l.replace("-","_"):"en"}/`,a=t+e+"messages.json",c=0;v(a).then(async function o(n){try{let e=await n.json(),o={};for(var s in e)"object"==typeof e[s]&&"message"in e[s]&&(o[s]=e[s].message);i(o)}catch(e){if(3==++c)return i({});v(a=l.includes("-")&&1==c?a.replace(/([^_]*)_[^/]*(\/.*)/,"$1$2"):t+"en/messages.json").then(o).catch(r)}}).catch(r)});try{c=await a}catch(e){console.error("ERROR fetching messages: "+e.message)}let m={},f={flags:{quietMode:/^--?q(?:uiet)?(?:-?mode)?$/},infoCmds:{help:/^--?h(?:elp)?$/,version:/^--?ve?r?s?i?o?n?$/}};if(process.argv.forEach(o=>{var e,n;o.startsWith("-")&&(e=Object.keys(f.flags).find(e=>f.flags[e].test(o)),n=Object.keys(f.infoCmds).find(e=>f.infoCmds[e].test(o)),e?m[e]=!0:n||(console.error(`
13
13
  ${""+(c.prefix_error||"ERROR")}: `+`Arg [${o}] ${c.error_notRecognized||"not recognized"}.`),console.info(`
14
14
  ${""+(c.info_validArgs||"Valid arguments are below")}.`),_(["configOptions","infoCmds"]),process.exit(1)))}),process.argv.some(e=>f.infoCmds.help.test(e)))_();else if(process.argv.some(e=>f.infoCmds.version.test(e))){a=i(`npm view ${pkgName} version`).toString().trim()||"none";let e,o=process.cwd();for(;"/"!=o;){var d=s.join(o,"package.json");if(n.existsSync(d)){d=require(d);e=(d.dependencies?.[pkgName]||d.devDependencies?.[pkgName])?.match(/^[~^>=]?\d+\.\d+\.\d+$/)?.[1]||"none";break}o=s.dirname(o)}console.info(`
15
15
  ${c.prefix_globalVer||"Global version"}: `+a),console.info(`${c.prefix_localVer||"Local version"}: `+e)}else{var $,h,u=[];for($ of process.argv.slice(2))$.startsWith("-")||(h=$.replace(/[[\]]/g,""),u.push(h));a=await e.locate(u,{verbose:!m.quietMode});a||process.exit(1),m.quietMode||1!=a.length||(console.info(`
@@ -3,4 +3,4 @@
3
3
  * Source: https://code.geolocatejs.org
4
4
  * Documentation: https://docs.geolocatejs.org
5
5
  */
6
- async function geolocate(e,n={}){let o={verbose:!0},i="geolocate() ยป ";(e=Array.isArray(e)?e:[e])[0]||=await fetch("https://ifconfig.me/ip").then(e=>e.text()).catch(()=>fetch("http://ip-api.com/json/").then(e=>e.json()).then(e=>e.query)).catch(async()=>{try{var e=require("child_process").exec,o=require("util").promisify,{stdout:t,stderr:r}=await o(e)("curl -s ifconfig.me");return r?console.error(i,r):t.trim()}catch(e){console.error(i,e)}});for(var t of e){n.verbose&&console.info(i+`Validating ${t}...`);let o;try{o=require("generate-ip").ipv4.validate}catch(e){await import("https://cdn.jsdelivr.net/npm/generate-ip/dist/generate-ip.min.js"),o=ipv4.validate}if(o&&!o(t,{verbose:!1}))return console.error(i+`ERROR: ${t} is not a valid IPv4 address.`)}if(validateOptions(n,o,"https://docs.geolocatejs.org/#locateips-options","geolocate('8.8.8.8', { verbose: false })")){n={...o,...n};try{var s,c=[];for(s of e){n.verbose&&console.info(i+`Fetching geolocation data for ${s}...`);let{status:e,org:o,as:t,query:r,...a}=await(await fetchData("http://ip-api.com/json/"+s)).json();a={ip:s,...a},c.push(a)}return n.verbose&&"undefined"!=typeof window&&console.info("${logPrefix}Success! Check returned array."),c}catch(e){console.error(i+"ERROR:",e.message)}}}function fetchData(r){return"undefined"==typeof fetch?new Promise((t,o)=>{try{var e=r.match(/^([^:]+):\/\//)[1];/^https?$/.test(e)||o(new Error("Invalid fetchData() URL.")),require(e).get(r,e=>{let o="";e.on("data",e=>o+=e),e.on("end",()=>t({json:()=>JSON.parse(o)}))}).on("error",e=>o(new Error(e.message)))}catch(e){o(new Error("Environment not supported."))}}):fetch(r)}function validateOptions(e,o,t,r){let a=JSON.stringify(o,void 0,2).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'").replace(/\n\s*/g," "),n=Object.keys(o).join(", "),i=Object.keys(o).filter(e=>"boolean"==typeof o[e]),s=`${validateOptions.caller?.name||"validateOptions"}() ยป `;var c,l=r.split(",").findIndex(e=>e.trim().startsWith("{"))+1,p=(l+=["st","nd","rd"][l-1]||"th",()=>{console.info(s+`Valid options: [ ${n} ]`),console.info(s+"If omitted, default settings are: "+a)}),f=()=>{console.info(s+"For more help, please visit "+t)};if("object"!=typeof e)return console.error(s+`ERROR: ${"0th"==l?"[O":l+" arg [o"}ptions] can only be an object of key/values.`),console.info(s+"Example valid call: "+r),p(),f(),!1;for(c in e){if(!Object.prototype.hasOwnProperty.call(o,c))return console.error(s+`ERROR: \`${c}\` is an invalid option.`),p(),f(),!1;if(i.includes(c)&&"boolean"!=typeof e[c])return console.error(s+`ERROR: [${c}] option can only be \`true\` or \`false\`.`),f(),!1}return!0}let geoAliases={geolocate:["Geolocate","geoLocate","GeoLocate","locate","Locate"]};try{module.exports={geolocate:geolocate}}catch(e){}try{window.geo={geolocate:geolocate}}catch(e){}for(let o in geoAliases){try{geoAliases[o].forEach(e=>module.exports[e]=module.exports[o])}catch(e){}try{geoAliases[o].forEach(e=>window.geo[e]=window.geo[o])}catch(e){}}
6
+ async function geolocate(e,n={}){let o={verbose:!0},i="geolocate() ยป ";(e=Array.isArray(e)?e:[e])[0]||=await fetch("https://ifconfig.me/ip").then(e=>e.text()).catch(()=>fetch("http://ip-api.com/json/").then(e=>e.json()).then(e=>e.query)).catch(async()=>{try{var e=require("child_process").exec,o=require("util").promisify,{stdout:t,stderr:r}=await o(e)("curl -s ifconfig.me");return r?console.error(i,r):t.trim()}catch(e){console.error(i,e)}});for(var t of e){n.verbose&&console.info(i+`Validating ${t}...`);let o;try{o=require("generate-ip").ipv4.validate}catch(e){await import("https://cdn.jsdelivr.net/npm/generate-ip/dist/generate-ip.min.js"),o=ipv4.validate}if(o&&!o(t,{verbose:!1}))return console.error(i+`ERROR: ${t} is not a valid IPv4 address.`)}if(validateOptions(n,o,"https://docs.geolocatejs.org/#locateips-options","geolocate('8.8.8.8', { verbose: false })")){n={...o,...n};try{var s,c=[];for(s of e){n.verbose&&console.info(i+`Fetching geolocation data for ${s}...`);let{status:e,org:o,as:t,query:r,...a}=await(await fetchData("http://ip-api.com/json/"+s)).json();a={ip:s,...a},c.push(a)}return n.verbose&&"undefined"!=typeof window&&console.info("${logPrefix}Success! Check returned array."),c}catch(e){console.error(i+"ERROR:",e.message)}}}function fetchData(r){return"undefined"==typeof fetch?new Promise((t,o)=>{try{var e=r.match(/^([^:]+):\/\//)[1];/^https?$/.test(e)||o(new Error("Invalid fetchData() URL.")),require(e).get(r,e=>{let o="";e.on("data",e=>o+=e),e.on("end",()=>t({json:()=>JSON.parse(o)}))}).on("error",e=>o(new Error(e.message)))}catch(e){o(new Error("Environment not supported."))}}):fetch(r)}function validateOptions(e,o,t,r){let a=JSON.stringify(o,void 0,2).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'").replace(/\n\s*/g," "),n=Object.keys(o).join(", "),i=Object.keys(o).filter(e=>"boolean"==typeof o[e]),s=`${validateOptions.caller?.name||"validateOptions"}() ยป `;var c,l=r.split(",").findIndex(e=>e.trim().startsWith("{"))+1;function f(){console.info(s+`Valid options: [ ${n} ]`),console.info(s+"If omitted, default settings are: "+a)}function p(){console.info(s+"For more help, please visit "+t)}if(l+=["st","nd","rd"][l-1]||"th","object"!=typeof e)return console.error(s+`ERROR: ${"0th"==l?"[O":l+" arg [o"}ptions] can only be an object of key/values.`),console.info(s+"Example valid call: "+r),f(),p(),!1;for(c in e){if(!Object.prototype.hasOwnProperty.call(o,c))return console.error(s+`ERROR: \`${c}\` is an invalid option.`),f(),p(),!1;if(i.includes(c)&&"boolean"!=typeof e[c])return console.error(s+`ERROR: [${c}] option can only be \`true\` or \`false\`.`),p(),!1}return!0}let geoAliases={geolocate:["Geolocate","geoLocate","GeoLocate","locate","Locate"]};try{module.exports={geolocate:geolocate}}catch(e){}try{window.geo={geolocate:geolocate}}catch(e){}for(let o in geoAliases){try{geoAliases[o].forEach(e=>module.exports[e]=module.exports[o])}catch(e){}try{geoAliases[o].forEach(e=>window.geo[e]=window.geo[o])}catch(e){}}
package/docs/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ <a id="top"></a>
2
+
1
3
  # <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.geolocatejs.org/images/icons/wire-globe/white/icon32.png?0d36e26"><img height=28 src="https://media.geolocatejs.org/images/icons/wire-globe/black/icon32.png?0d36e26"></picture> geolocate
2
4
 
3
5
  ### Fetch IP geolocation data from the CLI.
@@ -5,17 +7,17 @@
5
7
  <a href="https://www.npmjs.com/package/@adamlui/geolocate">
6
8
  <img height=31 src="https://img.shields.io/npm/dm/@adamlui/geolocate?logo=npm&color=af68ff&logoColor=white&labelColor=464646&style=for-the-badge"></a>
7
9
  <a href="#%EF%B8%8F-mit-license">
8
- <img height=31 src="https://img.shields.io/badge/License-MIT-fc4f2d.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
9
- <a href="https://github.com/adamlui/js-utils/releases/tag/geolocate-2.0.13">
10
- <img height=31 src="https://img.shields.io/badge/Latest_Build-2.0.13-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
10
+ <img height=31 src="https://img.shields.io/badge/License-MIT-orange.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
11
+ <a href="https://github.com/adamlui/js-utils/releases/tag/geolocate-2.0.14">
12
+ <img height=31 src="https://img.shields.io/badge/Latest_Build-2.0.14-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
11
13
  <a href="https://www.npmjs.com/package/@adamlui/geolocate?activeTab=code">
12
14
  <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>
13
- <a href="https://github.com/adamlui/js-utils/blob/geolocate-2.0.13/geolocate/dist/geolocate.min.js">
14
- <img height=31 src="https://img.shields.io/github/size/adamlui/js-utils/geolocate/dist/geolocate.min.js?branch=geolocate-2.0.13&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
15
+ <a href="https://github.com/adamlui/js-utils/blob/geolocate-2.0.14/geolocate/dist/geolocate.min.js">
16
+ <img height=31 src="https://img.shields.io/github/size/adamlui/js-utils/geolocate/dist/geolocate.min.js?branch=geolocate-2.0.14&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
15
17
  <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_js-utils:geolocate/src/geolocate.js">
16
18
  <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>
17
19
  <a href="https://github.com/toolleeo/cli-apps#networking">
18
- <img height=31 src="https://img.shields.io/badge/Mentioned_in-Awesome-c4a2bd?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge"></a>
20
+ <img height=31 src="https://img.shields.io/badge/Mentioned_in-Awesome-ff69b4?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge"></a>
19
21
 
20
22
  <br>
21
23
 
@@ -91,7 +93,7 @@ import geo from '@adamlui/geolocate';
91
93
  #### CommonJS:
92
94
 
93
95
  ```js
94
- const geo = require('@adamlui/geolocate');
96
+ const geo = require('@adamlui/geolocate')
95
97
  ```
96
98
 
97
99
  ###### _*Node.js version 14 or higher required_
@@ -101,23 +103,23 @@ const geo = require('@adamlui/geolocate');
101
103
  #### <> HTML script tag:
102
104
 
103
105
  ```html
104
- <script src="https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.13/dist/geolocate.min.js"></script>
106
+ <script src="https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.14/dist/geolocate.min.js"></script>
105
107
  ```
106
108
 
107
109
  #### ES6:
108
110
 
109
111
  ```js
110
112
  (async () => {
111
- await import('https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.13/dist/geolocate.min.js');
113
+ await import('https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.14/dist/geolocate.min.js')
112
114
  // Your code here...
113
- })();
115
+ })()
114
116
  ```
115
117
 
116
118
  ### <img height=17 src="https://assets.js-utils.org/images/icons/platforms/tampermonkey/icon28.png?v=0d36e26"><img height=17.5 src="https://assets.js-utils.org/images/icons/platforms/violentmonkey/icon25.png?v=0d36e26"> Greasemonkey
117
119
 
118
120
  ```js
119
121
  ...
120
- // @require https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.13/dist/geolocate.min.js
122
+ // @require https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.14/dist/geolocate.min.js
121
123
  // ==/UserScript==
122
124
 
123
125
  // Your code here...
@@ -125,7 +127,7 @@ const geo = require('@adamlui/geolocate');
125
127
 
126
128
  <br>
127
129
 
128
- **๐Ÿ“ Note:** To always import the latest version (not recommended in production!) remove the `@2.0.13` version tag from the jsDelivr URL: `https://cdn.jsdelivr.net/npm/@adamlui/geolocate/dist/geolocate.min.js`
130
+ **๐Ÿ“ Note:** To always import the latest version (not recommended in production!) remove the `@2.0.14` version tag from the jsDelivr URL: `https://cdn.jsdelivr.net/npm/@adamlui/geolocate/dist/geolocate.min.js`
129
131
 
130
132
  <br>
131
133
 
@@ -140,18 +142,18 @@ const geo = require('@adamlui/geolocate');
140
142
  Example:
141
143
 
142
144
  ```js
143
- const geo = require('@adamlui/geolocate');
145
+ const geo = require('@adamlui/geolocate')
144
146
 
145
147
  // Using await syntax
146
148
  (async () => {
147
- const location = await geo.locate('8.8.8.8');
148
- console.log(location);
149
- })();
149
+ const location = await geo.locate('8.8.8.8')
150
+ console.log(location)
151
+ })()
150
152
 
151
153
  // Using .then() syntax
152
154
  geo.locate('8.8.8.8').then(location => {
153
- console.log(location);
154
- });
155
+ console.log(location)
156
+ })
155
157
 
156
158
  /* outputs:
157
159
  [{
@@ -222,4 +224,4 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
222
224
 
223
225
  <picture><source media="(prefers-color-scheme: dark)" srcset="https://assets.js-utils.org/images/icons/home/white/icon32x27.png?v=0d36e26"><img height=13 src="https://assets.js-utils.org/images/icons/home/dark-gray/icon32x27.png?v=0d36e26"></picture> <a href="https://js-utils.org">**More JavaScript utilities**</a> /
224
226
  <a href="https://github.com/adamlui/js-utils/discussions">Discuss</a> /
225
- <a href="#-geolocate">Back to top โ†‘</a>
227
+ <a href="#top">Back to top โ†‘</a>
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@adamlui/geolocate",
3
- "version": "2.0.13",
3
+ "version": "2.0.14",
4
4
  "description": "Fetch IP geolocation data from the CLI.",
5
5
  "author": {
6
6
  "name": "Adam Lui",
7
7
  "email": "adam@kudoai.com",
8
8
  "url": "https://github.com/adamlui"
9
9
  },
10
- "homepage": "https://geolocatejs.org",
10
+ "homepage": "https://github.com/adamlui/js-utils",
11
11
  "license": "MIT",
12
12
  "funding": [
13
13
  {
@@ -57,10 +57,10 @@
57
57
  "cli"
58
58
  ],
59
59
  "bugs": {
60
- "url": "https://support.geolocatejs.org"
60
+ "url": "https://github.com/adamlui/js-utils/issues"
61
61
  },
62
62
  "dependencies": {
63
- "generate-ip": "^2.4.6"
63
+ "generate-ip": "^2.4.7"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@adamlui/minify.js": "^2.1.0"