diff options
author | cjihrig <cjihrig@gmail.com> | 2015-01-28 20:05:53 -0500 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2015-01-31 23:47:29 -0500 |
commit | 6ac8bdc0aba5f60f4b4f2da5abd36d664062aa40 (patch) | |
tree | 29a3b1ce92cfad3ae5d41a4ba7451846beace950 /lib/_stream_transform.js | |
parent | bce7a2608eb198eee6ecd7991062efd6daeeb440 (diff) | |
download | node-new-6ac8bdc0aba5f60f4b4f2da5abd36d664062aa40.tar.gz |
lib: reduce util.is*() usage
Many of the util.is*() methods used to check data types
simply compare against a single value or the result of
typeof. This commit replaces calls to these methods with
equivalent checks. This commit does not touch calls to the
more complex methods (isRegExp(), isDate(), etc.).
Fixes: https://github.com/iojs/io.js/issues/607
PR-URL: https://github.com/iojs/io.js/pull/647
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'lib/_stream_transform.js')
-rw-r--r-- | lib/_stream_transform.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/_stream_transform.js b/lib/_stream_transform.js index f836208633..d3e7a13486 100644 --- a/lib/_stream_transform.js +++ b/lib/_stream_transform.js @@ -72,7 +72,7 @@ function afterTransform(stream, er, data) { ts.writechunk = null; ts.writecb = null; - if (!util.isNullOrUndefined(data)) + if (data !== null && data !== undefined) stream.push(data); if (cb) @@ -106,7 +106,7 @@ function Transform(options) { this._readableState.sync = false; this.once('prefinish', function() { - if (util.isFunction(this._flush)) + if (typeof this._flush === 'function') this._flush(function(er) { done(stream, er); }); @@ -154,7 +154,7 @@ Transform.prototype._write = function(chunk, encoding, cb) { Transform.prototype._read = function(n) { var ts = this._transformState; - if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) { + if (ts.writechunk !== null && ts.writecb && !ts.transforming) { ts.transforming = true; this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); } else { |