1
0
mirror of https://github.com/GenderDysphoria/GenderDysphoria.fyi.git synced 2025-11-25 20:42:40 +00:00
Files
GenderDysphoria.fyi/gulp/lib/through.js
Jocelyn Badgley (Twipped) 1c45fdaf33 Initial site commit
2020-02-20 14:38:25 -08:00

20 lines
502 B
JavaScript

const log = require('fancy-log');
var through = require('through2');
module.exports = exports = function asyncthrough (...args) {
const [ fn, donefn ] = args;
args[0] = function (file, enc, next) {
fn(this, file, enc).then(() => next(), (err) => { log.error(err, 'Error thrown'); next(err); });
};
if (donefn) {
args[1] = function (next) {
donefn(this).then(() => next(), (err) => { log.error(err, 'Error thrown'); next(err); });
};
}
return through.obj(...args);
};