UNPKG

good-requests-filter

Version:

Simple transform stream for filtering specific resuqest logging with good

27 lines (19 loc) 535 B
'use strict'; const Stream = require('stream'); class GoodRequestsFilter extends Stream.Transform { constructor(config) { super({ objectMode: true }); this._settings = config; } _transform(data, enc, next) { if (data.path) { for (const i in this._settings.paths) { if (this._settings.paths[i].exec(data.path)) { return next(null); } } } next(null, data); } } module.exports = GoodRequestsFilter;