diff options
| author | Arman Shah <[email protected]> | 2018-02-19 23:50:04 -0800 |
|---|---|---|
| committer | Arman Shah <[email protected]> | 2018-02-19 23:50:04 -0800 |
| commit | ae34dcfd3823a609ba7182f2d6eda593be876f7d (patch) | |
| tree | b9d7f2884c4999349418cbdc4f9ab46d113e0afd /node_modules/through2/through2.js | |
| parent | Initial commit (diff) | |
| download | launcher-ae34dcfd3823a609ba7182f2d6eda593be876f7d.tar.xz launcher-ae34dcfd3823a609ba7182f2d6eda593be876f7d.zip | |
add base files
Diffstat (limited to 'node_modules/through2/through2.js')
| -rw-r--r-- | node_modules/through2/through2.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/node_modules/through2/through2.js b/node_modules/through2/through2.js new file mode 100644 index 0000000..0a88c82 --- /dev/null +++ b/node_modules/through2/through2.js @@ -0,0 +1,42 @@ +const Transform = require('stream').Transform || require('readable-stream/transform') + , inherits = require('util').inherits + , xtend = require('xtend') + +function noop (chunk, enc, callback) { + callback(null, chunk) +} + +function ctor (options, transform, flush) { + if (typeof options == 'function') { + flush = transform + transform = options + options = {} + } + + if (typeof transform != 'function') + transform = noop + + function Through2 (override) { + if (!(this instanceof Through2)) + return new Through2(override) + + this.options = xtend(options, override) + Transform.call(this, this.options) + } + + inherits(Through2, Transform) + + Through2.prototype._transform = transform + + if (typeof flush == 'function') + Through2.prototype._flush = flush + + return Through2 +} + +function make (options, transform, flush) { + return ctor(options, transform, flush)() +} + +module.exports = make +module.exports.ctor = ctor
\ No newline at end of file |