diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 290ad02..0bc3b42 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,3 +6,6 @@ updates: interval: daily time: "10:00" open-pull-requests-limit: 10 + commit-message: + prefix: "deps" + prefix-development: "deps(dev)" diff --git a/README.md b/README.md index a8dbdc7..8879cca 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ - [Usage](#usage) - [Contribute](#contribute) - [License](#license) -- [Contribution](#contribution) +- [Contribute](#contribute-1) ## Install @@ -59,6 +59,6 @@ Licensed under either of - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) - MIT ([LICENSE-MIT](LICENSE-MIT) / ) -## Contribution +## Contribute Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. diff --git a/package.json b/package.json index c45a2d7..f1f9ece 100644 --- a/package.json +++ b/package.json @@ -102,15 +102,15 @@ "release": "patch" }, { - "type": "chore", + "type": "docs", "release": "patch" }, { - "type": "docs", + "type": "test", "release": "patch" }, { - "type": "test", + "type": "deps", "release": "patch" }, { @@ -140,7 +140,11 @@ }, { "type": "docs", - "section": "Trivial Changes" + "section": "Documentation" + }, + { + "type": "deps", + "section": "Dependencies" }, { "type": "test", @@ -172,10 +176,10 @@ }, "dependencies": { "@achingbrain/ip-address": "^8.1.0", - "@libp2p/interface-connection": "^3.0.1", - "@libp2p/interface-peer-store": "^1.0.0", + "@libp2p/interface-connection": "^3.0.2", + "@libp2p/interface-peer-store": "^1.2.1", "@libp2p/logger": "^2.0.0", - "@multiformats/multiaddr": "^10.1.1", + "@multiformats/multiaddr": "^11.0.0", "abortable-iterator": "^4.0.2", "err-code": "^3.0.1", "is-loopback-addr": "^2.0.1", diff --git a/src/array-equals.ts b/src/array-equals.ts index 7455201..3d530d4 100644 --- a/src/array-equals.ts +++ b/src/array-equals.ts @@ -4,5 +4,12 @@ */ export function arrayEquals (a: any[], b: any[]) { const sort = (a: any, b: any) => a.toString().localeCompare(b.toString()) - return a.length === b.length && b.sort(sort) && a.sort(sort).every((item, index) => b[index].equals(item)) + + if (a.length !== b.length) { + return false + } + + b.sort(sort) + + return a.sort(sort).every((item, index) => b[index].equals(item)) } diff --git a/src/ip-port-to-multiaddr.ts b/src/ip-port-to-multiaddr.ts index adad125..12cfe40 100644 --- a/src/ip-port-to-multiaddr.ts +++ b/src/ip-port-to-multiaddr.ts @@ -1,5 +1,5 @@ import { logger } from '@libp2p/logger' -import { Multiaddr } from '@multiformats/multiaddr' +import { multiaddr } from '@multiformats/multiaddr' import errCode from 'err-code' import { Address4, Address6 } from '@achingbrain/ip-address' @@ -30,15 +30,15 @@ export function ipPortToMultiaddr (ip: string, port: number | string) { try { // Test valid IPv4 new Address4(ip) // eslint-disable-line no-new - return new Multiaddr(`/ip4/${ip}/tcp/${port}`) + return multiaddr(`/ip4/${ip}/tcp/${port}`) } catch {} try { // Test valid IPv6 const ip6 = new Address6(ip) return ip6.is4() - ? new Multiaddr(`/ip4/${ip6.to4().correctForm()}/tcp/${port}`) - : new Multiaddr(`/ip6/${ip}/tcp/${port}`) + ? multiaddr(`/ip4/${ip6.to4().correctForm()}/tcp/${port}`) + : multiaddr(`/ip6/${ip}/tcp/${port}`) } catch (err) { const errMsg = `invalid ip:port for creating a multiaddr: ${ip}:${port}` log.error(errMsg)