@@ -158,12 +158,12 @@ var flatten = function(options) {
158
158
var content ;
159
159
if ( ! moduleInfo . licenses || moduleInfo . licenses . indexOf ( UNKNOWN ) > - 1 ) {
160
160
//Only re-check the license if we didn't get it from elsewhere
161
- content = fs . readFileSync ( licenseFile , { encoding : 'utf8' } ) ;
161
+ content = fs . readFileSync ( licenseFile , { encoding : 'utf8' } ) ;
162
162
moduleInfo . licenses = license ( content ) ;
163
163
}
164
164
moduleInfo . licenseFile = options . basePath ? path . relative ( options . basePath , licenseFile ) : licenseFile ;
165
165
if ( ! content ) {
166
- content = fs . readFileSync ( moduleInfo . licenseFile , { encoding : 'utf8' } ) ;
166
+ content = fs . readFileSync ( moduleInfo . licenseFile , { encoding : 'utf8' } ) ;
167
167
}
168
168
if ( options . customFormat ) {
169
169
moduleInfo . licenseText = content . replace ( / " / g, '\'' ) . replace ( / \r ? \n | \r / g, " " ) . trim ( ) ;
@@ -183,7 +183,7 @@ var flatten = function(options) {
183
183
if ( json . dependencies ) {
184
184
Object . keys ( json . dependencies ) . forEach ( function ( name ) {
185
185
var childDependency = json . dependencies [ name ] ,
186
- dependencyId = childDependency . name + '@' + childDependency . version ;
186
+ dependencyId = childDependency . name + '@' + childDependency . version ;
187
187
if ( data [ dependencyId ] ) { // already exists
188
188
return ;
189
189
}
@@ -306,12 +306,12 @@ exports.asTree = function(sorted) {
306
306
} ;
307
307
308
308
exports . asCSV = function ( sorted , customFormat , csvComponentPrefix ) {
309
- var text = [ ] , textArr = [ ] , lineArr = [ ] ;
309
+ var text = [ ] , textArr = [ ] , lineArr = [ ] ;
310
310
var prefixName = '"component"' ;
311
311
var prefix = csvComponentPrefix ;
312
312
313
313
if ( customFormat && Object . keys ( customFormat ) . length > 0 ) {
314
- textArr = [ ] ;
314
+ textArr = [ ] ;
315
315
if ( csvComponentPrefix ) { textArr . push ( prefixName ) ; }
316
316
textArr . push ( '"module name"' ) ;
317
317
Object . keys ( customFormat ) . forEach ( function forEachCallback ( item ) {
@@ -329,8 +329,8 @@ exports.asCSV = function(sorted, customFormat, csvComponentPrefix) {
329
329
330
330
Object . keys ( sorted ) . forEach ( function ( key ) {
331
331
var module = sorted [ key ] ,
332
- line = '' ;
333
- lineArr = [ ] ;
332
+ line = '' ;
333
+ lineArr = [ ] ;
334
334
335
335
//Grab the custom keys from the custom format
336
336
if ( customFormat && Object . keys ( customFormat ) . length > 0 ) {
@@ -397,18 +397,17 @@ exports.parseJson = function(jsonPath) {
397
397
result = { } ;
398
398
399
399
try {
400
- jsonFileContents = fs . readFileSync ( jsonPath , { encoding : 'utf8' } ) ;
400
+ jsonFileContents = fs . readFileSync ( jsonPath , { encoding : 'utf8' } ) ;
401
401
result = JSON . parse ( jsonFileContents ) ;
402
402
} catch ( err ) {
403
403
result = err ;
404
- } finally {
405
- return result ;
406
404
}
405
+ return result ;
407
406
} ;
408
407
409
408
exports . asFiles = function ( json , outDir ) {
410
409
mkdirp . sync ( outDir ) ;
411
- Object . keys ( json ) . forEach ( function ( moduleName ) {
410
+ Object . keys ( json ) . forEach ( function ( moduleName ) {
412
411
var licenseFile = json [ moduleName ] . licenseFile ,
413
412
fileContents , outFileName , outPath ;
414
413
0 commit comments