Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 5637330

Browse files
authored
perf: use lodash (#1414)
Other modules we depend on also depend on lodash. We actually save around 100KB on bundle size if we use lodash like we use async (require functions we need from the main package) since the functions we require can be deduped because they're already being depended on. License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
1 parent 6975fb3 commit 5637330

File tree

6 files changed

+7
-13
lines changed

6 files changed

+7
-13
lines changed

package.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
"hat": "0.0.3",
7676
"interface-ipfs-core": "~0.69.0",
7777
"ipfsd-ctl": "~0.37.3",
78-
"lodash": "^4.17.10",
7978
"mocha": "^5.1.1",
8079
"ncp": "^2.0.0",
8180
"nexpect": "~0.5.0",
@@ -138,12 +137,7 @@
138137
"libp2p-webrtc-star": "~0.15.0",
139138
"libp2p-websocket-star": "~0.8.0",
140139
"libp2p-websockets": "~0.12.0",
141-
"lodash.flatmap": "^4.5.0",
142-
"lodash.flattendeep": "^4.4.0",
143-
"lodash.get": "^4.4.2",
144-
"lodash.set": "^4.3.2",
145-
"lodash.sortby": "^4.7.0",
146-
"lodash.values": "^4.3.0",
140+
"lodash": "^4.17.10",
147141
"mafmt": "^6.0.0",
148142
"mime-types": "^2.1.18",
149143
"mkdirp": "~0.5.1",

src/cli/commands/files/add.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const fs = require('fs')
44
const path = require('path')
55
const glob = require('glob')
6-
const sortBy = require('lodash.sortby')
6+
const sortBy = require('lodash/sortBy')
77
const pull = require('pull-stream')
88
const paramap = require('pull-paramap')
99
const zip = require('pull-zip')

src/core/components/dag.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const promisify = require('promisify-es6')
44
const CID = require('cids')
55
const pull = require('pull-stream')
66
const mapAsync = require('async/map')
7-
const flattenDeep = require('lodash.flattendeep')
7+
const flattenDeep = require('lodash/flattenDeep')
88

99
module.exports = function dag (self) {
1010
return {

src/core/components/libp2p.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// libp2p-nodejs gets replaced by libp2p-browser when webpacked/browserified
44
const Node = require('../runtime/libp2p-nodejs')
55
const promisify = require('promisify-es6')
6-
const get = require('lodash.get')
6+
const get = require('lodash/get')
77

88
module.exports = function libp2p (self) {
99
return {

src/core/components/swarm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const multiaddr = require('multiaddr')
44
const promisify = require('promisify-es6')
5-
const values = require('lodash.values')
5+
const values = require('lodash/values')
66

77
const OFFLINE_ERROR = require('../utils').OFFLINE_ERROR
88

src/http/api/resources/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict'
22

33
const debug = require('debug')
4-
const get = require('lodash.get')
5-
const set = require('lodash.set')
4+
const get = require('lodash/get')
5+
const set = require('lodash/set')
66
const log = debug('jsipfs:http-api:config')
77
log.error = debug('jsipfs:http-api:config:error')
88
const multipart = require('ipfs-multipart')

0 commit comments

Comments
 (0)