From 1f01fe774568026febb8e4e41d3a1dd95b5315b9 Mon Sep 17 00:00:00 2001 From: Chris Campbell Date: Thu, 15 Dec 2016 21:06:54 -0800 Subject: [PATCH] Use lodash.includes instead of the deprecated lodash.contains (#39) * .gitignore Vim swp files * Use lodash.includes instead of the deprecated lodash.contains --- .gitignore | 3 +++ package.json | 4 ++-- src/index.js | 4 ++-- src/listener.js | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index c2ba637..c1af64b 100644 --- a/.gitignore +++ b/.gitignore @@ -32,4 +32,7 @@ node_modules # Optional REPL history .node_repl_history +# Vim editor swap files +*.swp + dist diff --git a/package.json b/package.json index c3574fe..912488f 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "homepage": "https://github.com/libp2p/js-libp2p-websockets#readme", "dependencies": { "interface-connection": "^0.3.0", - "lodash.contains": "^2.4.3", + "lodash.includes": "^4.3.0", "mafmt": "^2.1.2", "pull-ws": "^3.2.8" }, @@ -58,4 +58,4 @@ "Richard Littauer ", "greenkeeperio-bot " ] -} \ No newline at end of file +} diff --git a/src/index.js b/src/index.js index 40a826d..57da7b0 100644 --- a/src/index.js +++ b/src/index.js @@ -2,7 +2,7 @@ const connect = require('pull-ws/client') const mafmt = require('mafmt') -const contains = require('lodash.contains') +const includes = require('lodash.includes') const Connection = require('interface-connection').Connection const debug = require('debug') const log = debug('libp2p:websockets:dialer') @@ -51,7 +51,7 @@ module.exports = class WebSockets { } return multiaddrs.filter((ma) => { - if (contains(ma.protoNames(), 'ipfs')) { + if (includes(ma.protoNames(), 'ipfs')) { ma = ma.decapsulate('ipfs') } return mafmt.WebSockets.matches(ma) diff --git a/src/listener.js b/src/listener.js index c2cfc56..bbe8bbd 100644 --- a/src/listener.js +++ b/src/listener.js @@ -1,7 +1,7 @@ 'use strict' const Connection = require('interface-connection').Connection -const contains = require('lodash.contains') +const includes = require('lodash.includes') // const IPFS_CODE = 421 @@ -28,7 +28,7 @@ module.exports = (options, handler) => { cb = cb || (() => {}) listeningMultiaddr = ma - if (contains(ma.protoNames(), 'ipfs')) { + if (includes(ma.protoNames(), 'ipfs')) { ma = ma.decapsulate('ipfs') }