Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function cachingCoffeify(file) {
if (!coffeeify.isCoffee(file)) return through();
var data = ''
, stream = through(write, end);
function write (buf) { data += buf; }
function end() {
var hash = getHash(data)
, cached = cache[file];
if (!cached || cached.hash !== hash) {
coffeeify.compile(file, data, function(error, result) {
if (error) return stream.emit('error', error);
cache[file] = { compiled: result, hash: hash };
stream.queue(result);
stream.queue(null);
});