Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rjweb/utils

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rjweb/utils - npm Package Compare versions

Comparing version 1.10.1 to 1.10.2

docs/functions/func.wrap.html

5

CHANGELOG.md

@@ -0,1 +1,6 @@

## 1.10.2
- Improve `dns.resolveHost`
- Fix some IPv6 parsing issues
## 1.10.1

@@ -2,0 +7,0 @@

2

docs/assets/navigation.js

@@ -1,1 +0,1 @@

window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAA52XbW/TMBDHv0teV8BGKdB3FQioxEPHpAppmibXuTVmiZ35oVtBfPc5id06i3MJfVnf/369O5/ty9XfRMOjTuYJkZLsk0lSEp3Zn4VITQ7qZb38ItNFbm13jKfJfDpJaMbyVAJP5ldHwA4k2cIRcWs41UxwD3GCNmw2/Tc5IODekLwfUJsR95wVTPe712bEXRKeiqLfv7EPAtgfpAYHCYaBQuwwRm3HAEITjQFqOwJQBimDNXZcrwPnlKtuG9nFUU0kQYl8B1+Eim5khQkkaBy3zP7xXmkouuEcbaOi2oL+VHnEQgpQXoZVVksg0eIGnEaEJsdBPwh5183MGUaltVwtUrumgrxoTpQKMAdJG3h2/i4I5tJsrL4f0tgxwrfFr5vlaj29+frj++cjaEckI5swrZawTXx93gXOxgJnQ0BqpK2eXq5ie+dhBxHSAal44LkgKcbxGgTDFB5KZUfdn29aDBHbuJHt7CE9vXxEaIgfdQ+o7PhRMMUGZOQk1OujDgLNCI+/XA7SCJAstsDt4xa/dB3DS055wBxi6AUrQVLbfwjBKdDHw/B4czaE2o5uiNj8Bqq7G9Ksj9qQFKD8IIqSyGhFHSlQYQfOqlZEqiFSrUETuzdgoJtXvTwqrYs2wN+TDeCii6kuyWvkuPkIYoesJwSmqyYUMlYMh/EStBZWy/g2GopdHxXK2l3GdeFltywO1ZZhr0gKVO7La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BYVYrjKbbvgZtA0Em3EgYXosBiQLiDHyxEFzndAbq/h07YAikQcCFfZ81d+0jGRA6aG+8R9F21aJ/qAf0QRGIufHYvqEJogX1NuD6K9+lCiY9xeW6P11Tu9M1KHdBpKEv0Jrra3csCejC6Ygb0Pk67Y5GAk0Qc8jGXG9VczjJsiEaJXv4DvQPGGIq9lMQV0qcukbqIBVU4juIGzx5Xftz9yBs4F9yuTQ8XQKeQVkJZes54ZKpPTkMlEHqh1wts0rVBmWuBp0ccUz9e1SDFixHbaCB/yu5rmrP8YGUAN2kuVa2J9tBK0G0iuvbVfrzxibFzbZLCcJWXB95bb2rDfAoLuD+BSigB3Jfcj1szxoZMvVw1gggAnN9xNWJ7p1FsEIAHSy4Mde9xAbUQCdJrpPKYncyBQkYccOtLIi5DVSViJtN+4NBQA+0L+LKQ/8OI2gg8Cc4f/4AFPAGKEazNtcjv9CNuN7tfpkA1HxQfgNuqICfHACaIICA41KlTwt3AhqMM5A9Idfc7uc2wEgDyc4qube+0/bdcBApyKCAywT/kP+hxGUsAlmUsP3jf74DNBK0kVVy78qCPABKgqslZkzaoenSId9ey4FiFHNu/VliECpwq7nRXG/BV6BLQ+GnBi7nu+MPoASBXlU+eWNfsBMul7pfpQBgQSoFXAXcnRAVyHnFtniD+xaMNk5jZ3Edgl7SnFr7binoG9AoyVFsD0SA+Q80KWGV3BsRoB+AJ+WXuSEXpj9pDxoHsk1zzIaX8EGew1tFrvs7xbX/6QUAHUx7ghuR4NcIgGNQsQSXLt1hD+gRZBmj1R58AekC7xrJenU9nazzdbbMCyN0df36+j8LsaMRnEkAAA==";

@@ -36,20 +36,17 @@ "use strict";

var dns = __toESM(require("dns"));
async function resolveHost(host) {
async function resolveHost(host, prefer = "v4") {
if ((0, import_network.isIP)(host))
return new import_network.IPAddress(host);
try {
const v4 = await dns.promises.resolve4(host);
if (!v4.length)
throw 1;
return new import_network.IPAddress(v4[0]);
} catch (e) {
try {
const v6 = await dns.promises.resolve6(host);
if (!v6.length)
throw 1;
return new import_network.IPAddress(v6[0]);
} catch (e2) {
}
}
throw new Error(`No IP could be resolved for \`${host}\``);
const [[v4], [v6]] = await Promise.all([
dns.promises.resolve4(host),
dns.promises.resolve6(host)
]);
if (!v4 && !v6)
throw new Error(`No IP could be resolved for \`${host}\``);
if (prefer === "v4" && v4)
return new import_network.IPAddress(v4);
else if (prefer === "v6" && v6)
return new import_network.IPAddress(v6);
else
return new import_network.IPAddress(v4 || v6);
}

@@ -56,0 +53,0 @@ // Annotate the CommonJS export names for ESM import in node:

@@ -513,3 +513,3 @@ "use strict";

function isIP(ip, type = "v6 | v4") {
if (type !== "v6") {
if (type !== "v6" && !ip.includes(":")) {
const res = checkV4(ip);

@@ -556,3 +556,3 @@ if (res)

function isSubnet(ip, type = "v6 | v4") {
if (type !== "v6") {
if (type !== "v6" && !ip.includes(":")) {
const [content, mask] = ip.split("/");

@@ -559,0 +559,0 @@ if (mask) {

{
"name": "@rjweb/utils",
"version": "1.10.1",
"version": "1.10.2",
"description": "Easy and Lightweight Utilities",

@@ -5,0 +5,0 @@ "module": "lib/esm/index.js",

import { IPAddress, isIP } from "./network";
import * as dns from "dns";
async function resolveHost(host) {
async function resolveHost(host, prefer = "v4") {
if (isIP(host))
return new IPAddress(host);
try {
const v4 = await dns.promises.resolve4(host);
if (!v4.length)
throw 1;
return new IPAddress(v4[0]);
} catch (e) {
try {
const v6 = await dns.promises.resolve6(host);
if (!v6.length)
throw 1;
return new IPAddress(v6[0]);
} catch (e2) {
}
}
throw new Error(`No IP could be resolved for \`${host}\``);
const [[v4], [v6]] = await Promise.all([
dns.promises.resolve4(host),
dns.promises.resolve6(host)
]);
if (!v4 && !v6)
throw new Error(`No IP could be resolved for \`${host}\``);
if (prefer === "v4" && v4)
return new IPAddress(v4);
else if (prefer === "v6" && v6)
return new IPAddress(v6);
else
return new IPAddress(v4 || v6);
}

@@ -22,0 +19,0 @@ export {

@@ -471,3 +471,3 @@ import * as net from "net";

function isIP(ip, type = "v6 | v4") {
if (type !== "v6") {
if (type !== "v6" && !ip.includes(":")) {
const res = checkV4(ip);

@@ -514,3 +514,3 @@ if (res)

function isSubnet(ip, type = "v6 | v4") {
if (type !== "v6") {
if (type !== "v6" && !ip.includes(":")) {
const [content, mask] = ip.split("/");

@@ -517,0 +517,0 @@ if (mask) {

{
"name": "@rjweb/utils",
"version": "1.10.1",
"version": "1.10.2",
"description": "Easy and Lightweight Utilities",

@@ -5,0 +5,0 @@ "module": "lib/esm/index.js",

@@ -81,4 +81,4 @@ /**

*
* array.random(arr, 2) // ['C']
* array.random(arr, 4) // ['A']
* array.random(arr, 2) // 'C'
* array.random(arr, 4) // 'A'
* ```

@@ -85,0 +85,0 @@ * @since 1.9.1

@@ -9,6 +9,7 @@ import { IPAddress } from "./network";

* await dns.resolveHost('1.1.1.1') // <IPAddress v4 1.1.1.1>
* await dns.resolveHost('google.com') // <IPAddress v4 142.250.185.78>
* await dns.resolveHost('google.com', 'v4') // <IPAddress v4 142.250.185.78>
* await dns.resolveHost('google.com', 'v6') // <IPAddress v4 2a00:1450:400d:803::200e:>
* ```
* @throws If no IP Could be resolved
* @since 1.8.0
*/ export declare function resolveHost(host: string): Promise<IPAddress>;
*/ export declare function resolveHost(host: string, prefer?: 'v4' | 'v6'): Promise<IPAddress>;

@@ -239,3 +239,3 @@ /// <reference types="node" />

* (data, args) => {
* retrun args.text
* return args.text
* }

@@ -242,0 +242,0 @@ * )

{
"name": "@rjweb/utils",
"version": "1.10.1",
"version": "1.10.2",
"description": "Easy and Lightweight Utilities",

@@ -5,0 +5,0 @@ "module": "lib/esm/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc