From 84f50c704e5d2a37e5ab678732bf76a2d29109d2 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Fri, 28 Sep 2018 16:57:11 +0100 Subject: [PATCH 1/2] chore: require just functions needed from lodash License: MIT Signed-off-by: Alan Shaw --- src/files/stat.js | 5 +++-- src/pin/ls.js | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/files/stat.js b/src/files/stat.js index 4077d1945..a205fea8e 100644 --- a/src/files/stat.js +++ b/src/files/stat.js @@ -1,7 +1,8 @@ 'use strict' const promisify = require('promisify-es6') -const _ = require('lodash') +const mapKeys = require('lodash/mapKeys') +const kebabCase = require('lodash/kebabCase') const transform = function (data, callback) { callback(null, { @@ -23,7 +24,7 @@ module.exports = (send) => { opts = {} } - opts = _.mapKeys(opts, (v, k) => _.kebabCase(k)) + opts = mapKeys(opts, (v, k) => kebabCase(k)) send.andTransform({ path: 'files/stat', diff --git a/src/pin/ls.js b/src/pin/ls.js index 45f6d600f..91db49f15 100644 --- a/src/pin/ls.js +++ b/src/pin/ls.js @@ -1,7 +1,7 @@ 'use strict' const promisify = require('promisify-es6') -const _ = require('lodash') +const keys = require('lodash/keys') module.exports = (send) => { return promisify((hash, opts, callback) => { @@ -28,7 +28,7 @@ module.exports = (send) => { if (err) { return callback(err) } - callback(null, _.keys(res.Keys).map(hash => ( + callback(null, keys(res.Keys).map(hash => ( { hash, type: res.Keys[hash].Type } ))) }) From b02786157392ae1c5269d04064936bf3361210fb Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Fri, 28 Sep 2018 17:01:26 +0100 Subject: [PATCH 2/2] fix: addmissing lodash to dependencies License: MIT Signed-off-by: Alan Shaw --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 36f2a3d33..747a6086e 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "is-pull-stream": "0.0.0", "is-stream": "^1.1.0", "libp2p-crypto": "~0.13.0", + "lodash": "^4.17.11", "lru-cache": "^4.1.3", "multiaddr": "^5.0.0", "multibase": "~0.4.0",