Skip to content

Instantly share code, notes, and snippets.

@brycebaril
Last active December 20, 2015 14:19
Show Gist options
  • Save brycebaril/6145578 to your computer and use it in GitHub Desktop.
Save brycebaril/6145578 to your computer and use it in GitHub Desktop.
A Transform type constructor possible extension for through2
var Transform = require("stream").Transform
var inherits = require("util").inherits
module.exports.ctor = function ctor(fn) {
function T(options) {
if (!(this instanceof T)) return new T(options)
Transform.call(this, options)
}
inherits(T, Transform)
T.prototype._transform = fn
return T
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment