File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 1111 this . loadData ( ) ;
1212 }
1313
14+ Bang . prototype . dataPath = process . env . HOME + "/.bang" ;
15+
1416 Bang . prototype . loadData = function ( ) {
15- var dataPath ;
16- dataPath = process . env . HOME + "/.bang" ;
17- return this . data = path . existsSync ( dataPath ) ? JSON . parse ( fs . readFileSync ( dataPath ) ) : { } ;
17+ return this . data = path . existsSync ( this . dataPath ) ? JSON . parse ( fs . readFileSync ( this . dataPath ) ) : { } ;
1818 } ;
1919
2020 Bang . prototype . save = function ( ) {
Original file line number Diff line number Diff line change @@ -7,12 +7,13 @@ module.exports = class Bang
77 constructor : ->
88 @ loadData ()
99
10+ # The file where data is persisted to disk.
11+ dataPath : process .env .HOME + " /.bang"
12+
1013 # Initializes Bang's data store.
1114 loadData : ->
12- dataPath = process .env .HOME + " /.bang"
13-
14- @data = if path .existsSync dataPath
15- JSON .parse fs .readFileSync dataPath
15+ @data = if path .existsSync @dataPath
16+ JSON .parse fs .readFileSync @dataPath
1617 else
1718 {}
1819
You can’t perform that action at this time.
0 commit comments