@adamlui/geolocate 2.0.11 → 2.0.12

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
@@ -5,13 +5,13 @@
5
5
  <a href="https://www.npmjs.com/package/@adamlui/geolocate">
6
6
  <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
7
  <a href="#%EF%B8%8F-mit-license">
8
- <img height=31 src="https://img.shields.io/badge/License-MIT-orange.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.11">
10
- <img height=31 src="https://img.shields.io/badge/Latest_Build-2.0.11-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
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.12">
10
+ <img height=31 src="https://img.shields.io/badge/Latest_Build-2.0.12-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
11
11
  <a href="https://www.npmjs.com/package/@adamlui/geolocate?activeTab=code">
12
12
  <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.11/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.11&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
13
+ <a href="https://github.com/adamlui/js-utils/blob/geolocate-2.0.12/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.12&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
15
15
  <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_js-utils:geolocate/src/geolocate.js">
16
16
  <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
17
  <a href="https://github.com/toolleeo/cli-apps#networking">
@@ -101,14 +101,14 @@ const geo = require('@adamlui/geolocate');
101
101
  #### <> HTML script tag:
102
102
 
103
103
  ```html
104
- <script src="https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.11/dist/geolocate.min.js"></script>
104
+ <script src="https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.12/dist/geolocate.min.js"></script>
105
105
  ```
106
106
 
107
107
  #### ES6:
108
108
 
109
109
  ```js
110
110
  (async () => {
111
- await import('https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.11/dist/geolocate.min.js');
111
+ await import('https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.12/dist/geolocate.min.js');
112
112
  // Your code here...
113
113
  })();
114
114
  ```
@@ -117,7 +117,7 @@ const geo = require('@adamlui/geolocate');
117
117
 
118
118
  ```js
119
119
  ...
120
- // @require https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.11/dist/geolocate.min.js
120
+ // @require https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.12/dist/geolocate.min.js
121
121
  // ==/UserScript==
122
122
 
123
123
  // Your code here...
@@ -125,7 +125,7 @@ const geo = require('@adamlui/geolocate');
125
125
 
126
126
  <br>
127
127
 
128
- **📝 Note:** To always import the latest version (not recommended in production!) remove the `@2.0.11` version tag from the jsDelivr URL: `https://cdn.jsdelivr.net/npm/@adamlui/geolocate/dist/geolocate.min.js`
128
+ **📝 Note:** To always import the latest version (not recommended in production!) remove the `@2.0.12` version tag from the jsDelivr URL: `https://cdn.jsdelivr.net/npm/@adamlui/geolocate/dist/geolocate.min.js`
129
129
 
130
130
  <br>
131
131
 
@@ -184,7 +184,7 @@ Name | Type | Description | Default Value
184
184
 
185
185
  ## 🏛️ MIT License
186
186
 
187
- **Copyright © 2024–2025 [Adam Lui](https://github.com/adamlui).**
187
+ **Copyright © 2024–2026 [Adam Lui](https://github.com/adamlui).**
188
188
 
189
189
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
190
190
 
package/dist/cli.min.js CHANGED
@@ -1,16 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * © 2024–2025 Adam Lui under the MIT license.
3
+ * © 2024–2026 Adam Lui under the MIT license.
4
4
  * Source: https://code.geolocatejs.org
5
5
  * Documentation: https://docs.geolocatejs.org
6
6
  */
7
- const pkgName="@adamlui/geolocate",copyright="© 2024–2025 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="3560750";(async()=>{const e=require(__dirname.match(/src/)?"./geolocate":"./geolocate.min"),n=require("fs"),s=require("path"),{execSync:i,execFileSync:o}=require("child_process"),t="",r="";let p="en";if("win32"==process.platform)try{p=i("(Get-Culture).TwoLetterISOLanguageName",{shell:"powershell",encoding:"utf-8"}).trim()}catch(e){_("Error loading system language: "+e)}else{var a=process.env;p=(a.LANG||a.LANGUAGE||a.LC_ALL||a.LC_MESSAGES||a.LC_NAME||"en").split(".")[0]}let c={};var l,g,a=new Promise((t,r)=>{const a=`https://cdn.jsdelivr.net/gh/adamlui/js-utils@fd79febbc6decf19f52d94e720d3b135fb4a625b/geolocate/_locales/`,e=(p?p.replace("-","_"):"en")+"/";let c=a+e+"messages.json",l=0;v(c).then(async function o(e){try{const n=await e.json(),s={};for(const i in n)"object"==typeof n[i]&&"message"in n[i]&&(s[i]=n[i].message);t(s)}catch(e){if(3==++l)return t({});v(c=p.includes("-")&&1==l?c.replace(/([^_]*)_[^/]*(\/.*)/,"$1$2"):a+"en/messages.json").then(o).catch(r)}}).catch(r)});try{c=await a}catch(e){_("Error fetching messages: "+e)}const 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(`
7
+ const 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="cc58ad6";(async()=>{"use strict";const e=require(__dirname.match(/src/)?"./geolocate":"./geolocate.min"),n=require("fs"),s=require("path"),{execSync:i,execFileSync:o}=require("child_process"),t="",r="";let p="en";if("win32"==process.platform)try{p=i("(Get-Culture).TwoLetterISOLanguageName",{shell:"powershell",encoding:"utf-8"}).trim()}catch(e){_("Error loading system language: "+e)}else{var a=process.env;p=(a.LANG||a.LANGUAGE||a.LC_ALL||a.LC_MESSAGES||a.LC_NAME||"en").split(".")[0]}let c={};var l,g,a=new Promise((t,r)=>{const a=`https://cdn.jsdelivr.net/gh/adamlui/js-utils@4e0119f46a73abd6c87d4c0405bf2d3c977d5421/geolocate/_locales/`,e=`${p?p.replace("-","_"):"en"}/`;let c=a+e+"messages.json",l=0;u(c).then(async function o(e){try{const n=await e.json(),s={};for(const i in n)"object"==typeof n[i]&&"message"in n[i]&&(s[i]=n[i].message);t(s)}catch(e){if(3==++l)return t({});u(c=p.includes("-")&&1==l?c.replace(/([^_]*)_[^/]*(\/.*)/,"$1$2"):a+"en/messages.json").then(o).catch(r)}}).catch(r)});try{c=await a}catch(e){_("Error fetching messages: "+e)}const 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(`
8
8
  ${""+(c.prefix_error||"ERROR")}: `+`Arg [${o}] ${c.error_notRecognized||"not recognized"}.`),console.info(`
9
- ${""+(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+$/)?.[0]||"none";break}o=s.dirname(o)}console.info(`
10
- ${c.prefix_globalVer||"Global version"}: `+a),console.info(`${c.prefix_localVer||"Local version"}: `+e)}else{var h,u=[];for(const L of process.argv.slice(2))L.startsWith("-")||(h=L.replace(/[[\]]/g,""),u.push(h));a=await e.locate(u,{verbose:!m.quietMode});a||process.exit(1),m.quietMode||1!=a.length||(console.info(`
11
- IP: `+r+a[0].ip+t),console.info(`${c.geoLabel_country||"Country"}: `+r+a[0].country+t),console.info(`${c.geoLabel_region||"Region"}: `+r+a[0].regionName+t),console.info(`${c.geoLabel_city||"City"}: `+r+a[0].city+t),console.info(`${c.geoLabel_zip||"Zip"}: `+r+a[0].zip+t),console.info(`${c.geoLabel_lat||"Latitude"}: `+r+a[0].lat+t),console.info(`${c.geoLabel_lon||"Longitude"}: `+r+a[0].lon+t),console.info(`${c.geoLabel_timeZone||"Time zone"}: `+r+a[0].timezone.replace(/_/g," ").replace(/\//g," / ")+t),console.info("ISP: "+r+a[0].isp+t)),_(`
12
- ${c.info_copying||"Copying to clipboard"}...`),l=(l=JSON.stringify(a,null,2)).replace(/"/g,'""'),g={darwin:{binPath:"/usr/bin/pbcopy",args:[]},linux:{binPath:"/usr/bin/xclip",args:["-selection","clipboard"]},win32:{binPath:s.join(process.env.SYSTEMROOT,"System32","WindowsPowerShell","v1.0","powershell.exe"),args:["-Command","Set-Clipboard -Value $input"]}},o(...Object.values(g[process.platform]),{input:l})}function v(s){return new Promise((n,e)=>{var o=s.match(/^([^:]+):\/\//)[1];/^https?$/.test(o)||e(new Error(`${c.error_invalidURL||"Invalid URL"}.`)),require(o).get(s,e=>{let o="";e.on("data",e=>o+=e),e.on("end",()=>n({json:()=>JSON.parse(o)}))}).on("error",e)})}function $(e=["header","usage","configOptions","infoCmds"]){var o=` ${pkgName.replace(/^@[^/]+\//,"")}  `;const n={header:["\n├ "+o+(c.appCopyright||copyright),o+(c.prefix_source||"Source")+": "+srcURL],usage:[`
13
- ${r}o ${c.helpSection_usage||"Usage"}:`," » "+cmdFormat+t],configOptions:[`
9
+ ${""+(c.info_validArgs||"Valid arguments are below")}.`),v(["configOptions","infoCmds"]),process.exit(1)))}),process.argv.some(e=>f.infoCmds.help.test(e)))v();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(`
10
+ ${c.prefix_globalVer||"Global version"}: `+a),console.info(`${c.prefix_localVer||"Local version"}: `+e)}else{var $,h=[];for(const L of process.argv.slice(2))L.startsWith("-")||($=L.replace(/[[\]]/g,""),h.push($));a=await e.locate(h,{verbose:!m.quietMode});a||process.exit(1),m.quietMode||1!=a.length||(console.info(`
11
+ IP: ${r}${a[0].ip}`),console.info(`${c.geoLabel_country||"Country"}: ${r}${a[0].country}${t}}`),console.info(`${c.geoLabel_region||"Region"}: ${r}${a[0].regionName}${t}}`),console.info(`${c.geoLabel_city||"City"}: ${r}${a[0].city}${t}}`),console.info(`${c.geoLabel_zip||"Zip"}: ${r}${a[0].zip}${t}}`),console.info(`${c.geoLabel_lat||"Latitude"}: ${r}${a[0].lat}${t}}`),console.info(`${c.geoLabel_lon||"Longitude"}: ${r}${a[0].lon}${t}}`),console.info(`${c.geoLabel_timeZone||"Time zone"}: ${r}${a[0].timezone.replace(/_/g," ").replace(/\//g," / ")}${t}`),console.info(`ISP: ${r}${a[0].isp}}`)),_(`
12
+ ${c.info_copying||"Copying to clipboard"}...`),l=(l=JSON.stringify(a,void 0,2)).replace(/"/g,'""'),g={darwin:{binPath:"/usr/bin/pbcopy",args:[]},linux:{binPath:"/usr/bin/xclip",args:["-selection","clipboard"]},win32:{binPath:s.join(process.env.SYSTEMROOT,"System32","WindowsPowerShell","v1.0","powershell.exe"),args:["-Command","Set-Clipboard -Value $input"]}},o(...Object.values(g[process.platform]),{input:l})}function u(s){return new Promise((n,e)=>{var o=s.match(/^([^:]+):\/\//)[1];/^https?$/.test(o)||e(new Error(`${c.error_invalidURL||"Invalid URL"}.`)),require(o).get(s,e=>{let o="";e.on("data",e=>o+=e),e.on("end",()=>n({json:()=>JSON.parse(o)}))}).on("error",e)})}function v(e=["header","usage","configOptions","infoCmds"]){var o=` ${pkgName.replace(/^@[^/]+\//,"")}  `;const n={header:[`
13
+ ├ `+o+(c.appCopyright||copyright),o+(c.prefix_source||"Source")+": "+srcURL],usage:[`
14
+ ${r}o ${c.helpSection_usage||"Usage"}:`,` ${r}» ${cmdFormat}`],configOptions:[`
14
15
  ${r}o ${c.helpSection_configOptions||"Config options"}:`,` -q, --quiet ${c.optionDesc_quiet||"Suppress all logging except errors"}.`],infoCmds:[`
15
16
  ${r}o ${c.helpSection_infoCmds||"Info commands"}:`," -h, --help "+(c.optionDesc_help||"Display help screen."),` -v, --version ${c.optionDesc_version||"Show version number"}.`]};e.forEach(r=>n[r]?.forEach(e=>{{var s=/header|usage/.test(r)?1:29;const i=process.stdout.columns||80,t=[],o=e.match(/\S+|\s+/g);let n="";o.forEach(e=>{var o=i-(t.length?s:0);n.length+"| ".length+e.length>o&&(t.push(t.length?n.trimStart():n),n=""),n+=e}),t.push(t.length?n.trimStart():n),t.forEach((e,o)=>console.info("| "+(0==o?e:" ".repeat(s)+e)))}})),console.info(`
16
- ${c.info_moreHelp||"For more help"}, ${c.info_visit||"visit"}: `+r+docURL+t)}function _(e){m.quietMode||console.info(e)}})();
17
+ ${c.info_moreHelp||"For more help"}, ${c.info_visit||"visit"}: ${r}${docURL}`)}function _(e){m.quietMode||console.info(e)}})();
@@ -1,6 +1,6 @@
1
1
  /**
2
- * © 2024–2025 Adam Lui under the MIT license.
2
+ * © 2024–2026 Adam Lui under the MIT license.
3
3
  * Source: https://code.geolocatejs.org
4
4
  * Documentation: https://docs.geolocatejs.org
5
5
  */
6
- async function geolocate(e,n={}){var o={verbose:!0};(e=Array.isArray(e)?e:[e])[0]=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("geolocate() »",r):t.trim()}catch(e){console.error("geolocate() »",e)}});for(const t of e){n.verbose&&console.info(`geolocate() » 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(`geolocate() » 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 c=[];for(const i of e){n.verbose&&console.info(`geolocate() » Fetching geolocation data for ${i}...`);let{status:e,org:o,as:t,query:r,...a}=await(await fetchData("http://ip-api.com/json/"+i)).json();a={ip:i,...a},c.push(a)}return n.verbose&&"undefined"!=typeof window&&console.info("geolocate() » Success! Check returned array."),c}catch(e){console.error("geolocate() » 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){const a=JSON.stringify(o,null,2).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'").replace(/\n\s*/g," "),n=Object.keys(o).join(", "),c=Object.keys(o).filter(e=>"boolean"==typeof o[e]),i=`${validateOptions.caller?.name||"validateOptions"}() » `;var s=r.split(",").findIndex(e=>e.trim().startsWith("{"))+1,l=(s+=["st","nd","rd"][s-1]||"th",()=>{console.info(i+`Valid options: [ ${n} ]`),console.info(i+"If omitted, default settings are: "+a)}),p=()=>{console.info(i+"For more help, please visit "+t)};if("object"!=typeof e)return console.error(i+`ERROR: ${"0th"==s?"[O":s+" arg [o"}ptions] can only be an object of key/values.`),console.info(i+"Example valid call: "+r),l(),p(),!1;for(const f in e){if(!Object.prototype.hasOwnProperty.call(o,f))return console.error(i+`ERROR: \`${f}\` is an invalid option.`),l(),p(),!1;if(c.includes(f)&&"boolean"!=typeof e[f])return console.error(i+`ERROR: [${f}] option can only be \`true\` or \`false\`.`),p(),!1}return!0}const geoAliases={geolocate:["Geolocate","geoLocate","GeoLocate","locate","Locate"]};try{module.exports={geolocate:geolocate}}catch(e){}try{window.geo={geolocate:geolocate}}catch(e){}for(const $ in geoAliases){try{geoAliases[$].forEach(e=>module.exports[e]=module.exports[$])}catch(e){}try{geoAliases[$].forEach(e=>window.geo[e]=window.geo[$])}catch(e){}}
6
+ async function geolocate(e,n={}){var o={verbose:!0};(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("geolocate() »",r):t.trim()}catch(e){console.error("geolocate() »",e)}});for(const t of e){n.verbose&&console.info(`geolocate() » 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(`geolocate() » 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 c=[];for(const i of e){n.verbose&&console.info(`geolocate() » Fetching geolocation data for ${i}...`);let{status:e,org:o,as:t,query:r,...a}=await(await fetchData("http://ip-api.com/json/"+i)).json();a={ip:i,...a},c.push(a)}return n.verbose&&"undefined"!=typeof window&&console.info("geolocate() » Success! Check returned array."),c}catch(e){console.error("geolocate() » 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){const a=JSON.stringify(o,void 0,2).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'").replace(/\n\s*/g," "),n=Object.keys(o).join(", "),c=Object.keys(o).filter(e=>"boolean"==typeof o[e]),i=`${validateOptions.caller?.name||"validateOptions"}() » `;var s=r.split(",").findIndex(e=>e.trim().startsWith("{"))+1,l=(s+=["st","nd","rd"][s-1]||"th",()=>{console.info(i+`Valid options: [ ${n} ]`),console.info(i+"If omitted, default settings are: "+a)}),p=()=>{console.info(i+"For more help, please visit "+t)};if("object"!=typeof e)return console.error(i+`ERROR: ${"0th"==s?"[O":s+" arg [o"}ptions] can only be an object of key/values.`),console.info(i+"Example valid call: "+r),l(),p(),!1;for(const f in e){if(!Object.prototype.hasOwnProperty.call(o,f))return console.error(i+`ERROR: \`${f}\` is an invalid option.`),l(),p(),!1;if(c.includes(f)&&"boolean"!=typeof e[f])return console.error(i+`ERROR: [${f}] option can only be \`true\` or \`false\`.`),p(),!1}return!0}const geoAliases={geolocate:["Geolocate","geoLocate","GeoLocate","locate","Locate"]};try{module.exports={geolocate:geolocate}}catch(e){}try{window.geo={geolocate:geolocate}}catch(e){}for(const $ in geoAliases){try{geoAliases[$].forEach(e=>module.exports[e]=module.exports[$])}catch(e){}try{geoAliases[$].forEach(e=>window.geo[e]=window.geo[$])}catch(e){}}
package/docs/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # 🏛️ MIT License
2
2
 
3
- **Copyright © 2024–2025 [Adam Lui](https://github.com/adamlui)**
3
+ **Copyright © 2024–2026 [Adam Lui](https://github.com/adamlui)**
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
package/docs/README.md CHANGED
@@ -5,13 +5,13 @@
5
5
  <a href="https://www.npmjs.com/package/@adamlui/geolocate">
6
6
  <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
7
  <a href="#%EF%B8%8F-mit-license">
8
- <img height=31 src="https://img.shields.io/badge/License-MIT-orange.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.11">
10
- <img height=31 src="https://img.shields.io/badge/Latest_Build-2.0.11-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
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.12">
10
+ <img height=31 src="https://img.shields.io/badge/Latest_Build-2.0.12-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
11
11
  <a href="https://www.npmjs.com/package/@adamlui/geolocate?activeTab=code">
12
12
  <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.11/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.11&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
13
+ <a href="https://github.com/adamlui/js-utils/blob/geolocate-2.0.12/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.12&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
15
15
  <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_js-utils:geolocate/src/geolocate.js">
16
16
  <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
17
  <a href="https://github.com/toolleeo/cli-apps#networking">
@@ -101,14 +101,14 @@ const geo = require('@adamlui/geolocate');
101
101
  #### <> HTML script tag:
102
102
 
103
103
  ```html
104
- <script src="https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.11/dist/geolocate.min.js"></script>
104
+ <script src="https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.12/dist/geolocate.min.js"></script>
105
105
  ```
106
106
 
107
107
  #### ES6:
108
108
 
109
109
  ```js
110
110
  (async () => {
111
- await import('https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.11/dist/geolocate.min.js');
111
+ await import('https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.12/dist/geolocate.min.js');
112
112
  // Your code here...
113
113
  })();
114
114
  ```
@@ -117,7 +117,7 @@ const geo = require('@adamlui/geolocate');
117
117
 
118
118
  ```js
119
119
  ...
120
- // @require https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.11/dist/geolocate.min.js
120
+ // @require https://cdn.jsdelivr.net/npm/@adamlui/geolocate@2.0.12/dist/geolocate.min.js
121
121
  // ==/UserScript==
122
122
 
123
123
  // Your code here...
@@ -125,7 +125,7 @@ const geo = require('@adamlui/geolocate');
125
125
 
126
126
  <br>
127
127
 
128
- **📝 Note:** To always import the latest version (not recommended in production!) remove the `@2.0.11` version tag from the jsDelivr URL: `https://cdn.jsdelivr.net/npm/@adamlui/geolocate/dist/geolocate.min.js`
128
+ **📝 Note:** To always import the latest version (not recommended in production!) remove the `@2.0.12` version tag from the jsDelivr URL: `https://cdn.jsdelivr.net/npm/@adamlui/geolocate/dist/geolocate.min.js`
129
129
 
130
130
  <br>
131
131
 
@@ -184,7 +184,7 @@ Name | Type | Description | Default Value
184
184
 
185
185
  ## 🏛️ MIT License
186
186
 
187
- **Copyright © 2024–2025 [Adam Lui](https://github.com/adamlui).**
187
+ **Copyright © 2024–2026 [Adam Lui](https://github.com/adamlui).**
188
188
 
189
189
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
190
190
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamlui/geolocate",
3
- "version": "2.0.11",
3
+ "version": "2.0.12",
4
4
  "description": "Fetch IP geolocation data from the CLI.",
5
5
  "author": {
6
6
  "name": "Adam Lui",
@@ -10,6 +10,10 @@
10
10
  "homepage": "https://geolocatejs.org",
11
11
  "license": "MIT",
12
12
  "funding": [
13
+ {
14
+ "type": "cashapp",
15
+ "url": "https://cash.app/$AdamLui"
16
+ },
13
17
  {
14
18
  "type": "github",
15
19
  "url": "http://github.com/sponsors/adamlui"
@@ -17,6 +21,10 @@
17
21
  {
18
22
  "type": "ko-fi",
19
23
  "url": "https://ko-fi.com/adamlui"
24
+ },
25
+ {
26
+ "type": "paypal",
27
+ "url": "https://paypal.me/adamlui"
20
28
  }
21
29
  ],
22
30
  "main": "dist/geolocate.min.js",
@@ -52,9 +60,9 @@
52
60
  "url": "https://support.geolocatejs.org"
53
61
  },
54
62
  "dependencies": {
55
- "generate-ip": "^2.4.4"
63
+ "generate-ip": "^2.4.5"
56
64
  },
57
65
  "devDependencies": {
58
- "@adamlui/minify.js": "^1.8.5"
66
+ "@adamlui/minify.js": "^1.8.6"
59
67
  }
60
68
  }