Socket
Socket
Sign inDemoInstall

stream-transform

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-transform - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

lib/es5/sync.js

10

CHANGELOG.md
# Changelog
## Version 1.0.3
* travis: support Node.js 10
* package: improve ignore files
* samples: update syntax
* sync: new module to ease synchronous usage
* stream: dont push empty string
## Version 1.0.2

@@ -10,3 +18,3 @@

* package: es5 backward compatiblity
* package: es5 backward compatibility
* package: ignore yarn lock file

@@ -13,0 +21,0 @@

22

lib/es5/index.js

@@ -28,7 +28,7 @@ 'use strict';

// `transform(handler, [options])`
// `transform([data], handler, [options])`
// Stream API, for maximum of power:
// `transform(data, [options], handler, [options], [callback])`
// `transform([data], [options], handler, [options], [callback])`
module.exports = function () {

@@ -86,7 +86,7 @@ var argument, callback, data, error, handler, i, j, k, len, options, result, transform, type, v;

transform.on('readable', function () {
var r, results;
var record, results;
results = [];
while (r = transform.read()) {
while (record = transform.read()) {
if (callback) {
results.push(result.push(r));
results.push(result.push(record));
} else {

@@ -155,3 +155,3 @@ results.push(void 0);

// sync
this._done(null, [this.transform.call(null, chunk, this.options.params)], cb);
this.__done(null, [this.transform.call(null, chunk, this.options.params)], cb);
} else if (l === 2) {

@@ -164,3 +164,3 @@ // async

return _this._done(err, chunks, cb);
return _this.__done(err, chunks, cb);
};

@@ -174,3 +174,3 @@ this.transform.call(null, chunk, callback, this.options.params);

err = error1;
return this._done(err);
return this.__done(err);
}

@@ -188,3 +188,3 @@ };

Transformer.prototype._done = function (err, chunks, cb) {
Transformer.prototype.__done = function (err, chunks, cb) {
var chunk, j, len;

@@ -201,3 +201,5 @@ this.running--;

}
if (chunk != null) {
if (chunk != null && chunk !== '') {
// We dont push empty string
// See https://nodejs.org/api/stream.html#stream_readable_push
this.push(chunk);

@@ -204,0 +206,0 @@ }

@@ -24,7 +24,7 @@ // Generated by CoffeeScript 2.0.3

// `transform(handler, [options])`
// `transform([data], handler, [options])`
// Stream API, for maximum of power:
// `transform(data, [options], handler, [options], [callback])`
// `transform([data], [options], handler, [options], [callback])`
module.exports = function() {

@@ -82,7 +82,7 @@ var argument, callback, data, error, handler, i, j, k, len, options, result, transform, type, v;

transform.on('readable', function() {
var r, results;
var record, results;
results = [];
while ((r = transform.read())) {
while ((record = transform.read())) {
if (callback) {
results.push(result.push(r));
results.push(result.push(record));
} else {

@@ -145,6 +145,6 @@ results.push(void 0);

if (l === 1) { // sync
this._done(null, [this.transform.call(null, chunk, this.options.params)], cb);
this.__done(null, [this.transform.call(null, chunk, this.options.params)], cb);
} else if (l === 2) { // async
callback = (err, ...chunks) => {
return this._done(err, chunks, cb);
return this.__done(err, chunks, cb);
};

@@ -158,3 +158,3 @@ this.transform.call(null, chunk, callback, this.options.params);

err = error1;
return this._done(err);
return this.__done(err);
}

@@ -172,3 +172,3 @@ };

Transformer.prototype._done = function(err, chunks, cb) {
Transformer.prototype.__done = function(err, chunks, cb) {
var chunk, j, len;

@@ -185,3 +185,5 @@ this.running--;

}
if (chunk != null) {
if ((chunk != null) && chunk !== '') {
// We dont push empty string
// See https://nodejs.org/api/stream.html#stream_readable_push
this.push(chunk);

@@ -188,0 +190,0 @@ }

{
"version": "1.0.2",
"version": "1.0.3",
"name": "stream-transform",

@@ -4,0 +4,0 @@ "description": "Object transformations implementing the Node.js `stream.Transform` API",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc