Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// decorate chunk
if(this.opts.field) {
chunk[this.opts.field] = output;
// mutate chunk
}else{
chunk = output;
}
}catch(e) {
this.emit('error', e);
}
}
this.push(chunk);
cb();
}
module.exports = through.transform(transform, {ctor: Parse});
}
/**
* Transform function.
*/
function transform(chunk, encoding, cb) {
if(typeof this.method === 'function') {
// mutate chunk through all function calls
// result of first call is passed to the next
chunk = this.method.call(chunk, this);
}
this.push(chunk);
cb();
}
module.exports = through.transform(transform, {ctor: Transform});
scope.push(chunk);
cb();
});
// cannot handle content, expecting string, buffer or readable stream
}else{
this.push(chunk);
cb();
}
// passthrough
}else{
this.push(chunk);
cb();
}
}
FileAsync.FileRead = through.transform(readTransform, {ctor: FileRead});
FileAsync.FileWrite = through.transform(writeTransform, {ctor: FileWrite});
module.exports = FileAsync;
function transform(chunk, encoding, cb) {
if(this.ps === undefined
&& this.info
&& this.info.previous
&& !(this.info.previous instanceof Process)) {
this.start(chunk);
}else{
this.push(chunk);
cb();
}
}
/* for some magical reason flush must be declared */
function flush() {}
module.exports = through.transform(transform, flush, {ctor: Process});
/**
* Transform function.
*/
function transform(chunk, encoding, cb) {
// invoke the prompt method
if(typeof this.method === 'function') {
this.method.call(this, this.ps, chunk, encoding, cb);
// pass through
}else{
this.push(chunk);
cb();
}
}
var Stream = through.transform(transform, {ctor: Prompt});
// static access to formatted prompt string data
Stream.getPrompt = function getPrompt(info, opts) {
var ps = prompt(opts);
return ps.format(info);
}
module.exports = Stream;
function load(opts) {
opts = opts || {};
function transform(chunk, encoding, cb) {
// TODO: handle URLs and protocols here
if(chunk instanceof DuplexFile) {
chunk.stream = fs.createReadStream(chunk.path);
}
cb();
}
var Type = through.transform(transform);
return new Type();
}
if(source !== chunk) {
// update contents reference for write() method
chunk.contents = stream;
this.push(chunk);
}else{
// push writable side of pipe if input chunk was readable stream
this.push(stream);
}
cb();
}else{
this.push(chunk);
cb();
}
}
module.exports = through.transform(transform, {ctor: Zlib});
module.exports.types = types;
module.exports.methods = methods;
/**
* Transform function.
*/
function transform(chunk, encoding, cb) {
if(typeof chunk === 'string') {
if(this.opts.trim) {
chunk = chunk.trim();
}
chunk = chunk.split(this.opts.ptn);
}
this.push(chunk);
cb();
}
module.exports = through.transform(transform, {ctor: Split});
function transform(chunk, encoding, cb) {
if(chunk) {
var k, v;
for(k in chunk) {
v = this.method.call(chunk[k], chunk, this);
if(v !== undefined) {
this.push(v);
}else{
this.push(chunk[k]);
}
}
}
cb();
}
module.exports = through.transform(transform, {ctor: Each});
&& !Array.isArray(chunk) && !Buffer.isBuffer(chunk)) {
res = uri.format(chunk);
}
if(res && opts.field && chunk) {
chunk[opts.field] = res;
}
if(res === undefined || opts.passthrough || opts.field) {
this.push(chunk);
}
if(res && !opts.field) {
this.push(res);
}
cb();
}
module.exports = through.transform(transform, {ctor: URL});