File tree 3 files changed +14
-3
lines changed
3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ Yam.prototype.getAll = function getAll() {
44
44
Yam . prototype . get = function get ( key ) {
45
45
var value = this . options [ key ] ;
46
46
47
- return value ? value : undefined ;
47
+ return value !== undefined ? value : undefined ;
48
48
} ;
49
49
50
50
module . exports = Yam ;
Original file line number Diff line number Diff line change 1
1
{
2
- "foo": "bar"
2
+ "foo": "bar",
3
+ "falsey": false
3
4
}
Original file line number Diff line number Diff line change @@ -43,6 +43,15 @@ describe('Yam', function() {
43
43
44
44
equal ( yam . get ( 'durp' ) , undefined ) ;
45
45
} ) ;
46
+
47
+ it ( 'returns `false` if the value is false' , function ( ) {
48
+ yam = new Yam ( 'test' , {
49
+ primary : 'test/fixtures/primary/' ,
50
+ secondary : 'test/fixtures/secondary/'
51
+ } ) ;
52
+
53
+ equal ( yam . get ( 'falsey' ) , false ) ;
54
+ } ) ;
46
55
} ) ;
47
56
48
57
describe ( 'constructor' , function ( ) {
@@ -60,7 +69,8 @@ describe('Yam', function() {
60
69
61
70
deepEqual ( yam . options , {
62
71
foo : 'bar' ,
63
- baz : 5
72
+ baz : 5 ,
73
+ falsey : false
64
74
} ) ;
65
75
} ) ;
66
76
} ) ;
You can’t perform that action at this time.
0 commit comments