@@ -48,10 +48,14 @@ function cleanupOnExit (tmpfile) {
48
48
function serializeActiveFile ( absoluteName ) {
49
49
return new Promise ( resolve => {
50
50
// make a queue if it doesn't already exist
51
- if ( ! activeFiles [ absoluteName ] ) activeFiles [ absoluteName ] = [ ]
51
+ if ( ! activeFiles [ absoluteName ] ) {
52
+ activeFiles [ absoluteName ] = [ ]
53
+ }
52
54
53
55
activeFiles [ absoluteName ] . push ( resolve ) // add this job to the queue
54
- if ( activeFiles [ absoluteName ] . length === 1 ) resolve ( ) // kick off the first one
56
+ if ( activeFiles [ absoluteName ] . length === 1 ) {
57
+ resolve ( )
58
+ } // kick off the first one
55
59
} )
56
60
}
57
61
@@ -151,7 +155,9 @@ async function writeFileAsync (filename, data, options = {}) {
151
155
activeFiles [ absoluteName ] . shift ( ) // remove the element added by serializeSameFile
152
156
if ( activeFiles [ absoluteName ] . length > 0 ) {
153
157
activeFiles [ absoluteName ] [ 0 ] ( ) // start next job if one is pending
154
- } else delete activeFiles [ absoluteName ]
158
+ } else {
159
+ delete activeFiles [ absoluteName ]
160
+ }
155
161
}
156
162
}
157
163
@@ -170,8 +176,11 @@ function writeFile (filename, data, options, callback) {
170
176
}
171
177
172
178
function writeFileSync ( filename , data , options ) {
173
- if ( typeof options === 'string' ) options = { encoding : options }
174
- else if ( ! options ) options = { }
179
+ if ( typeof options === 'string' ) {
180
+ options = { encoding : options }
181
+ } else if ( ! options ) {
182
+ options = { }
183
+ }
175
184
try {
176
185
filename = fs . realpathSync ( filename )
177
186
} catch ( ex ) {
0 commit comments