behind

Figure out if a file is behind its dependencies a la make

Behind

Does mtime checking of a dependent file vs a bunch of dependencies. Basically the same thing a make task does before running.

 
var behind = require('behind');
 
behind('./dependent.out', [ './dependency.in' ], function (errdeps) {
  if (err) throw err;
 
  // 
  // If there are no deps, `deps` is null. 
  // I'm open to changing this API. 
  // 
  if (deps) {
    console.log('stale dependencies:', deps);
  }
});

Alternately:

 
var behind = require('behind').sync;
 
var deps = behind('./dependent.out', [ './dependency.in' ]);
 
if (deps) {
  console.log('stale dependencies:', deps);
}

That's pretty much it.

MIT