This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 80
80
"joi" : " ^9.0.4" ,
81
81
"libp2p-ipfs" : " ^0.12.1" ,
82
82
"libp2p-ipfs-browser" : " ^0.12.1" ,
83
+ "lodash.get" : " ^4.4.1" ,
84
+ "lodash.has" : " ^4.5.2" ,
85
+ "lodash.set" : " ^4.3.1" ,
83
86
"lodash.sortby" : " ^4.6.1" ,
84
87
"mafmt" : " ^2.1.1" ,
85
88
"map-limit" : " 0.0.1" ,
86
- "lodash.get" : " ^4.4.1" ,
87
- "lodash.set" : " ^4.3.1" ,
88
89
"multiaddr" : " ^2.0.2" ,
89
90
"multihashes" : " ^0.2.2" ,
90
91
"path-exists" : " ^3.0.0" ,
Original file line number Diff line number Diff line change 2
2
3
3
const promisify = require ( 'promisify-es6' )
4
4
const _get = require ( 'lodash.get' )
5
+ const _has = require ( 'lodash.has' )
5
6
const _set = require ( 'lodash.set' )
6
7
7
8
module . exports = function config ( self ) {
@@ -24,11 +25,11 @@ module.exports = function config (self) {
24
25
if ( err ) {
25
26
return callback ( err )
26
27
}
27
- const value = _get ( config , key , undefined )
28
- if ( ! value ) {
29
- callback ( new Error ( 'Key does not exist in config' ) )
30
- } else {
28
+ if ( _has ( config , key ) ) {
29
+ const value = _get ( config , key , undefined )
31
30
callback ( null , value )
31
+ } else {
32
+ callback ( new Error ( 'Key does not exist in config' ) )
32
33
}
33
34
} )
34
35
} ) ,
@@ -37,7 +38,7 @@ module.exports = function config (self) {
37
38
return callback ( new Error ( 'Invalid key type' ) )
38
39
}
39
40
40
- if ( ! value || Buffer . isBuffer ( value ) ) {
41
+ if ( value === undefined || Buffer . isBuffer ( value ) ) {
41
42
return callback ( new Error ( 'Invalid value type' ) )
42
43
}
43
44
You can’t perform that action at this time.
0 commit comments