stream-transform
Advanced tools
Comparing version 0.2.2 to 1.0.0
@@ -1,5 +0,16 @@ | ||
// Generated by CoffeeScript 1.12.7 | ||
var Transformer, stream, util, | ||
slice = [].slice; | ||
// Generated by CoffeeScript 2.0.1 | ||
// # Stream Transformer | ||
// Pass all elements of an array or a stream to transform, filter and add. Features include: | ||
// * Extends the Node.js "stream.Transform" API. | ||
// * Both synchrounous and asynchronous support based and user callback | ||
// arguments signature. | ||
// * Ability to skip data. | ||
// * Sequential and concurrent execution using the "parallel" options. | ||
// Please look at the [README], the [samples] and the [tests] for additional | ||
// information. | ||
var Transformer, stream, util; | ||
stream = require('stream'); | ||
@@ -9,2 +20,11 @@ | ||
// ## Usage | ||
// Callback approach, for ease of use: | ||
// `transform(handler, [options])` | ||
// Stream API, for maximum of power: | ||
// `transform(data, [options], handler, [options], [callback])` | ||
module.exports = function() { | ||
@@ -88,5 +108,8 @@ var argument, callback, data, error, handler, i, j, k, len, options, result, transform, type, v; | ||
Transformer = function(options1, transform1) { | ||
// ## Transformer | ||
// Options are documented [here](http://csv.adaltas.com/transform/). | ||
Transformer = function(options1 = {}, transform1) { | ||
var base; | ||
this.options = options1 != null ? options1 : {}; | ||
this.options = options1; | ||
this.transform = transform1; | ||
@@ -121,12 +144,8 @@ this.options.objectMode = true; | ||
} | ||
if (l === 1) { | ||
if (l === 1) { // sync | ||
this._done(null, [this.transform.call(null, chunk, this.options.params)], cb); | ||
} else if (l === 2) { | ||
callback = (function(_this) { | ||
return function() { | ||
var chunks, err; | ||
err = arguments[0], chunks = 2 <= arguments.length ? slice.call(arguments, 1) : []; | ||
return _this._done(err, chunks, cb); | ||
}; | ||
})(this); | ||
} else if (l === 2) { // async | ||
callback = (err, ...chunks) => { | ||
return this._done(err, chunks, cb); | ||
}; | ||
this.transform.call(null, chunk, callback, this.options.params); | ||
@@ -162,3 +181,3 @@ } else { | ||
if (typeof chunk === 'number') { | ||
chunk = "" + chunk; | ||
chunk = `${chunk}`; | ||
} | ||
@@ -176,1 +195,5 @@ if (chunk != null) { | ||
}; | ||
// [readme]: https://github.com/wdavidw/node-stream-transform | ||
// [samples]: https://github.com/wdavidw/node-stream-transform/tree/master/samples | ||
// [tests]: https://github.com/wdavidw/node-stream-transform/tree/master/test |
{ | ||
"version": "0.2.2", | ||
"version": "1.0.0", | ||
"name": "stream-transform", | ||
@@ -14,6 +14,6 @@ "description": "Object transformations implementing the Node.js `stream.Transform` API", | ||
"devDependencies": { | ||
"coffee-script": "~1.12.7", | ||
"coffeescript": "~2.0.1", | ||
"pad": "~2.0.1", | ||
"mocha": "~4.0.1", | ||
"csv-generate": "~1.1.0", | ||
"csv-generate": "~2.0.0", | ||
"should": "~13.1.2" | ||
@@ -20,0 +20,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
11089
234
1