+4
-3
| /* eslint-env browser */ | ||
| import publicIp from 'public-ip'; | ||
| import {publicIpv4, publicIpv6} from 'public-ip'; | ||
@@ -11,2 +11,3 @@ export default async function isOnline(options) { | ||
| // eslint-disable-next-line n/no-unsupported-features/node-builtins | ||
| if (!navigator?.onLine) { | ||
@@ -16,6 +17,6 @@ return false; | ||
| const publicIpFunctionName = options.ipVersion === 4 ? 'v4' : 'v6'; | ||
| const publicIpFunction = options.ipVersion === 4 ? publicIpv4 : publicIpv6; | ||
| try { | ||
| await publicIp[publicIpFunctionName](options); | ||
| await publicIpFunction(options); | ||
| return true; | ||
@@ -22,0 +23,0 @@ } catch { |
+6
-7
| import os from 'node:os'; | ||
| import got, {CancelError} from 'got'; | ||
| import publicIp from 'public-ip'; | ||
| import {publicIpv4, publicIpv6} from 'public-ip'; | ||
| import pAny from 'p-any'; | ||
@@ -21,3 +21,3 @@ import pTimeout from 'p-timeout'; | ||
| const {body} = await gotPromise; | ||
| if (!body || !body.includes('Success')) { | ||
| if (!body?.includes('Success')) { | ||
| throw new Error('Apple check failed'); | ||
@@ -53,4 +53,3 @@ } | ||
| const publicIpFunctionName = options.ipVersion === 4 ? 'v4' : 'v6'; | ||
| const publicIpFunction = options.ipVersion === 4 ? publicIpv4 : publicIpv6; | ||
| const queries = []; | ||
@@ -60,3 +59,3 @@ | ||
| (async () => { | ||
| const query = publicIp[publicIpFunctionName](options); | ||
| const query = publicIpFunction(options); | ||
| queries.push(query); | ||
@@ -67,3 +66,3 @@ await query; | ||
| (async () => { | ||
| const query = publicIp[publicIpFunctionName]({...options, onlyHttps: true}); | ||
| const query = publicIpFunction({...options, onlyHttps: true}); | ||
| queries.push(query); | ||
@@ -81,3 +80,3 @@ await query; | ||
| return pTimeout(promise, options.timeout).catch(() => { | ||
| return pTimeout(promise, {milliseconds: options.timeout}).catch(() => { // eslint-disable-line promise/prefer-await-to-then | ||
| for (const query of queries) { | ||
@@ -84,0 +83,0 @@ query.cancel(); |
+9
-8
| { | ||
| "name": "is-online", | ||
| "version": "10.0.0", | ||
| "version": "11.0.0", | ||
| "description": "Check if the internet connection is up", | ||
@@ -22,4 +22,5 @@ "license": "MIT", | ||
| }, | ||
| "sideEffects": false, | ||
| "engines": { | ||
| "node": ">=14.16" | ||
| "node": ">=18" | ||
| }, | ||
@@ -57,11 +58,11 @@ "scripts": { | ||
| "dependencies": { | ||
| "got": "^12.1.0", | ||
| "got": "^13.0.0", | ||
| "p-any": "^4.0.0", | ||
| "p-timeout": "^5.1.0", | ||
| "public-ip": "^5.0.0" | ||
| "p-timeout": "^6.1.2", | ||
| "public-ip": "^7.0.1" | ||
| }, | ||
| "devDependencies": { | ||
| "ava": "^4.3.0", | ||
| "tsd": "^0.20.0", | ||
| "xo": "^0.49.0" | ||
| "ava": "^6.1.3", | ||
| "tsd": "^0.31.1", | ||
| "xo": "^0.59.2" | ||
| }, | ||
@@ -68,0 +69,0 @@ "ava": { |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
7668
2.05%129
0.78%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated