diff --git a/lib/file-operations.js b/lib/file-operations.js index e8f5adcd..2b59d665 100644 --- a/lib/file-operations.js +++ b/lib/file-operations.js @@ -5,7 +5,7 @@ var util = require('util'); var fs = require('graceful-fs'); var path = require('path'); var assign = require('object-assign'); -var isValidDate = require('vali-date'); +var date = require('value-or-function').date; var FlushWriteStream = require('flush-write-stream'); var constants = require('./constants'); @@ -52,24 +52,19 @@ function getModeDiff(fsMode, vinylMode) { function getTimesDiff(fsStat, vinylStat) { - if (!isValidDate(vinylStat.mtime)) { + var mtime = date(vinylStat.mtime); + if (!mtime) { return; } - if (+vinylStat.mtime === +fsStat.mtime && - +vinylStat.atime === +fsStat.atime) { + var atime = date(vinylStat.atime); + if (+mtime === +fsStat.mtime && + +atime === +fsStat.atime) { return; } - var atime; - if (isValidDate(vinylStat.atime)) { - atime = vinylStat.atime; - } else { - atime = fsStat.atime; - } - - if (!isValidDate(atime)) { - atime = undefined; + if (!atime) { + atime = date(fsStat.atime) || undefined; } var timesDiff = { diff --git a/package.json b/package.json index ad7a4723..4233a612 100644 --- a/package.json +++ b/package.json @@ -40,8 +40,7 @@ "strip-bom-stream": "^1.0.0", "through2": "^2.0.0", "through2-filter": "^2.0.0", - "vali-date": "^1.0.0", - "value-or-function": "^1.2.0", + "value-or-function": "^2.0.0", "vinyl": "^2.0.0" }, "devDependencies": {