'use strict';

var fs = require('graceful-fs');

// http://stackoverflow.com/a/10589791/586382
function validDate(date) {
  return date instanceof Date && !isNaN(date.valueOf());
}

function utimes(writePath, stat, cb) {
  var mtime = stat.mtime;

  if (validDate(mtime)) {
    var atime = stat.atime || new Date();

    if(validDate(atime)) {
      return fs.utimes(writePath, atime, mtime, cb);
    }
  }

  cb();
}

module.exports = utimes;

@@ -244,37 +244,8 @@
 me;%0A
-%0A  if (validDate(mtime)) %7B%0A  
   va
@@ -287,13 +287,32 @@
 %0A%0A  
- 
- 
 if
+ 
 (
+validDate(mtime) && 
 vali
@@ -327,18 +327,16 @@
 ime)) %7B%0A
-  
     retu
@@ -382,14 +382,8 @@
 b);%0A
-    %7D%0A
   %7D%0A

simplify utimes helper