Socket
Socket
Sign inDemoInstall

multiaddr

Package Overview
Dependencies
Maintainers
3
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multiaddr - npm Package Compare versions

Comparing version 6.0.2 to 6.0.3

13

CHANGELOG.md

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

<a name="6.0.3"></a>
## [6.0.3](https://github.com/multiformats/js-multiaddr/compare/v6.0.2...v6.0.3) (2019-01-08)
### Bug Fixes
* clean up repo and bundle size reduction ([136315a](https://github.com/multiformats/js-multiaddr/commit/136315a))
* increase bundle size limit ([b7fc015](https://github.com/multiformats/js-multiaddr/commit/b7fc015))
* remove unused deps ([3d8cb42](https://github.com/multiformats/js-multiaddr/commit/3d8cb42))
* update max bundle size ([116f227](https://github.com/multiformats/js-multiaddr/commit/116f227))
<a name="6.0.2"></a>

@@ -2,0 +15,0 @@ ## [6.0.2](https://github.com/multiformats/js-multiaddr/compare/v6.0.1...v6.0.2) (2018-12-17)

35

package.json
{
"name": "multiaddr",
"version": "6.0.2",
"version": "6.0.3",
"description": "multiaddr implementation (binary + string representation of network addresses)",

@@ -18,8 +18,10 @@ "leadMaintainer": "Victor Bjelkholm <victorbjelkholm@gmail.com>",

"coverage-publish": "aegir coverage publish",
"docs": "aegir docs"
"docs": "aegir docs",
"size": "bundlesize -f dist/index.min.js -s 14kB"
},
"repository": {
"type": "git",
"url": "https://github.com/multiformats/js-multiaddr.git"
},
"files": [
"src",
"dist"
],
"repository": "github:multiformats/js-multiaddr",
"keywords": [

@@ -31,5 +33,3 @@ "multiaddr",

"license": "MIT",
"bugs": {
"url": "https://github.com/multiformats/js-multiaddr/issues"
},
"bugs": "https://github.com/multiformats/js-multiaddr/issues",
"homepage": "https://github.com/multiformats/js-multiaddr",

@@ -40,14 +40,10 @@ "dependencies": {

"ip": "^1.1.5",
"ip-address": "^5.8.9",
"lodash.filter": "^4.6.0",
"lodash.map": "^4.6.0",
"varint": "^5.0.0",
"xtend": "^4.0.1"
"is-ip": "^2.0.0",
"varint": "^5.0.0"
},
"devDependencies": {
"aegir": "^17.1.1",
"buffer-loader": "0.0.1",
"chai": "^4.1.2",
"dirty-chai": "^2.0.1",
"pre-commit": "^1.2.2"
"aegir": "^18.0.3",
"bundlesize": "~0.17.0",
"chai": "^4.2.0",
"dirty-chai": "^2.0.1"
},

@@ -60,2 +56,3 @@ "contributors": [

"Friedel Ziegelmayer <dignifiedquire@gmail.com>",
"Hugo Dias <hugomrdias@gmail.com>",
"Jacob Heun <jacobheun@gmail.com>",

@@ -62,0 +59,0 @@ "Juan Batiz-Benet <juan@benet.ai>",

'use strict'
const map = require('lodash.map')
const filter = require('lodash.filter')
const convert = require('./convert')

@@ -66,3 +64,3 @@ const protocols = require('./protocols-table')

const parts = []
map(tuples, function (tup) {
tuples.map(tup => {
const proto = protoFromTuple(tup)

@@ -80,3 +78,3 @@ parts.push(proto.name)

function stringTuplesToTuples (tuples) {
return map(tuples, function (tup) {
return tuples.map(tup => {
if (!Array.isArray(tup)) {

@@ -95,3 +93,3 @@ tup = [tup]

function tuplesToStringTuples (tuples) {
return map(tuples, function (tup) {
return tuples.map(tup => {
const proto = protoFromTuple(tup)

@@ -107,3 +105,3 @@ if (tup.length > 1) {

function tuplesToBuffer (tuples) {
return fromBuffer(Buffer.concat(map(tuples, function (tup) {
return fromBuffer(Buffer.concat(tuples.map(tup => {
const proto = protoFromTuple(tup)

@@ -205,3 +203,3 @@ let buf = Buffer.from(varint.encode(proto.code))

function cleanPath (str) {
return '/' + filter(str.trim().split('/')).join('/')
return '/' + str.trim().split('/').filter(a => a).join('/')
}

@@ -208,0 +206,0 @@

'use strict'
const ip = require('ip')
const ipAddress = require('ip-address')
const isIp = require('is-ip')
const protocols = require('./protocols-table')

@@ -25,3 +25,3 @@ const bs58 = require('bs58')

case 41: // ipv6
return ip.toString(buf)
return buf2ip(buf)

@@ -50,5 +50,5 @@ case 6: // tcp

case 4: // ipv4
return ip2buf(new ipAddress.Address4(str))
return ip2buf(str)
case 41: // ipv6
return ip2buf(new ipAddress.Address6(str))
return ip2buf(str)

@@ -73,7 +73,17 @@ case 6: // tcp

function ip2buf (ipaddr) {
if (!ipaddr.isValid()) throw new Error('invalid ip address')
return ip.toBuffer(ipaddr.address)
function ip2buf (ipString) {
if (!isIp(ipString)) {
throw new Error('invalid ip address')
}
return ip.toBuffer(ipString)
}
function buf2ip (ipBuff) {
const ipString = ip.toString(ipBuff)
if (!isIp(ipString)) {
throw new Error('invalid ip address')
}
return ipString
}
function port2buf (port) {

@@ -80,0 +90,0 @@ const buf = Buffer.alloc(2)

'use strict'
const map = require('lodash.map')
const extend = require('xtend')
const codec = require('./codec')

@@ -111,6 +109,3 @@ const protocols = require('./protocols-table')

Multiaddr.prototype.protos = function protos () {
return map(this.protoCodes(), function (code) {
return extend(protocols(code))
// copy to prevent users from modifying the internal objs.
})
return this.protoCodes().map(code => Object.assign({}, protocols(code)))
}

@@ -155,5 +150,3 @@

Multiaddr.prototype.protoNames = function protoNames () {
return map(this.protos(), function (proto) {
return proto.name
})
return this.protos().map(proto => proto.name)
}

@@ -256,3 +249,3 @@

b58str = this.stringTuples().filter((tuple) => {
if (tuple[0] === protocols.names['ipfs'].code) {
if (tuple[0] === protocols.names.ipfs.code) {
return true

@@ -259,0 +252,0 @@ }

'use strict'
const map = require('lodash.map')
function Protocols (proto) {

@@ -61,3 +59,3 @@ if (typeof (proto) === 'number') {

// populate tables
map(Protocols.table, function (row) {
Protocols.table.map(row => {
const proto = p.apply(null, row)

@@ -64,0 +62,0 @@ Protocols.codes[proto.code] = proto

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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