bump dependencies

This commit is contained in:
Pavel Murygin 2021-04-09 18:23:24 +03:00
parent 5c177cddd9
commit 3d47c8d9be
3 changed files with 6 additions and 6 deletions

View File

@ -35,7 +35,7 @@
"util": "^0.12.3"
},
"dependencies": {
"multiaddr": "^8.0.0"
"multiaddr": "^9.0.1"
},
"contributors": [
"David Dias <daviddias.p@gmail.com>",

View File

@ -146,9 +146,9 @@ exports.IPFS = P2P
function makeMatchesFunction (partialMatch) {
return function matches (a) {
if (!multiaddr.isMultiaddr(a)) {
if (!multiaddr.Multiaddr.isMultiaddr(a)) {
try {
a = multiaddr(a)
a = new multiaddr.Multiaddr(a)
} catch (err) { // catch error
return false // also if it's invalid it's propably not matching as well so return false
}
@ -224,7 +224,7 @@ function base (n) {
function matches (a) {
if (typeof a === 'string') {
try {
a = multiaddr(a)
a = new multiaddr.Multiaddr(a)
} catch (err) { // catch error
return false // also if it's invalid it's propably not matching as well so return false
}

View File

@ -196,7 +196,7 @@ describe('multiaddr validation', function () {
test.forEach(function (testcase) {
try {
expect(p.matches(testcase), `assertMatches: ${testcase} (string)`).to.be.eql(true)
const ma = multiaddr(testcase)
const ma = new multiaddr.Multiaddr(testcase)
expect(p.matches(ma), `assertMatches: ${testcase} (multiaddr object)`).to.be.eql(true)
expect(p.matches(ma.bytes), `assertMatches: ${testcase} (multiaddr.bytes)`).to.be.eql(true)
} catch (err) {
@ -217,7 +217,7 @@ describe('multiaddr validation', function () {
try {
// if testcase string happens to be a valid multiaddr,
// we expect 'p' test to also return false for Multiaddr object and Uint8Array versions
validMultiaddrObj = multiaddr(testcase)
validMultiaddrObj = new multiaddr.Multiaddr(testcase)
} catch (e) {
// Ignoring testcase as the string is not a multiaddr
// (There is a separate 'Uint8Array is invalid' test later below)