bin/wafr.js
function writeStatsFile(statsFilePath, statsObject, callback) { // eslint-disable-line
  if (typeof statsFilePath !== 'string') {
    return callback();
  }

  if (utils.filenameExtension(statsFilePath) !== 'json') {
    throw new Error('Your stats output file must be a JSON file (i.e. --stats ./stats.json)');
  }

  fs.writeFile(path.resolve(statsFilePath), JSON.stringify(statsObject, null, 2), (writeStatsFileError) => {
    if (writeStatsFileError) {
      throw new Error(`while writting stats JSON file ${statsFilePath}: ${writeStatsFileError}`);
    }

    callback();
  });
}
function writeStatsFile(statsFilePath, statsObject, callback) { // eslint-disable-line
  if (typeof statsFilePath !== 'string') {
    return callback();
  }

  if (utils.filenameExtension(statsFilePath) !== 'json') {
    throw new Error('Your stats output file must be a JSON file (i.e. --stats ./stats.json)');
  }

  fs.writeFile(path.resolve(statsFilePath), JSON.stringify(statsObject, null, 2), (writeStatsFileError) => {
    if (writeStatsFileError) {
      throw new Error(`while writting stats JSON file ${statsFilePath}: ${writeStatsFileError}`);
    }

    callback();
  });
}
function writeStatsFile ( statsFilePath , statsObject , callback ) { // eslint-disable-line if ( typeof statsFilePath !== 'string' ) { return callback ( ) ; } if ( utils . filenameExtension ( statsFilePath ) !== 'json' ) { throw new Error ( 'Your stats output file must be a JSON file (i.e. --stats ./stats.json)' ) ; } fs . writeFile ( path . resolve ( statsFilePath ) , JSON . stringify ( statsObject , null , 2 ) , ( writeStatsFileError ) => { if ( writeStatsFileError ) { throw new Error ( ` ${ statsFilePath } ${ writeStatsFileError } ` ) ; } callback ( ) ; } ) ; }
write stats file
write stats file