"use strict";
const create_1 = require("./create");
const js_core_1 = require("js-core");
function debugFn(keypath = '', header = 'debug', logger = console.log, opts = {}) {
    return create_1.createWithOpt({
        transform(chunk, _enc) {
            // tslint:disable-next-line:no-invalid-this
            logger.call(this, header + ': ' + (keypath ? js_core_1.keypath(chunk, keypath) : chunk));
            return chunk;
        }
    }, opts);
}
exports.debugFn = debugFn;
