Files
DefinitelyTyped/gulp-if/gulp-if.d.ts
2015-08-20 08:21:50 -06:00

64 lines
3.2 KiB
TypeScript

// Type definitions for gulp-if
// Project: https://github.com/robrich/gulp-if
// Definitions by: Asana <https://asana.com>, Joe Skeen <http://github.com/joeskeen>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts"/>
/// <reference path="../vinyl/vinyl.d.ts"/>
declare module 'gulp-if' {
import fs = require('fs');
import vinyl = require('vinyl');
interface GulpIf {
/**
* gulp-if will pipe data to stream whenever condition is truthy.
* If condition is falsey and elseStream is passed, data will pipe to elseStream
* After data is piped to stream or elseStream or neither, data is piped down-stream.
*
* @param condition whether input should be piped to stream
* @param stream the stream to pipe to if condition is true
* @param elseStream (optional) the stream to pipe to if condition is false
*/
(condition: boolean, stream: NodeJS.ReadWriteStream, elseStream?: NodeJS.ReadWriteStream): NodeJS.ReadWriteStream;
/**
* gulp-if will pipe data to stream whenever condition is truthy.
* If condition is falsey and elseStream is passed, data will pipe to elseStream
* After data is piped to stream or elseStream or neither, data is piped down-stream.
*
* @param condition a Node Stat filter condition to be executed on the vinyl file's Stats object
* @param stream the stream to pipe to if condition is true
* @param elseStream (optional) the stream to pipe to if condition is false
*/
(condition: StatFilterCondition, stream: NodeJS.ReadWriteStream, elseStream?: NodeJS.ReadWriteStream): NodeJS.ReadWriteStream;
/**
* gulp-if will pipe data to stream whenever condition is truthy.
* If condition is falsey and elseStream is passed, data will pipe to elseStream
* After data is piped to stream or elseStream or neither, data is piped down-stream.
*
* @param condition a function taking a vinyl file and returning a boolean
* @param stream the stream to pipe to if condition is true
* @param elseStream (optional) the stream to pipe to if condition is false
*/
(condition: (fs: vinyl) => boolean, stream: NodeJS.ReadWriteStream, elseStream?: NodeJS.ReadWriteStream): NodeJS.ReadWriteStream;
/**
* gulp-if will pipe data to stream whenever condition is truthy.
* If condition is falsey and elseStream is passed, data will pipe to elseStream
* After data is piped to stream or elseStream or neither, data is piped down-stream.
*
* @param condition a RegularExpression that works on the file.path
* @param stream the stream to pipe to if condition is true
* @param elseStream (optional) the stream to pipe to if condition is false
*/
(condition: RegExp, stream: NodeJS.ReadWriteStream, elseStream?: NodeJS.ReadWriteStream): NodeJS.ReadWriteStream;
}
interface StatFilterCondition {
isDirectory?: boolean;
isFile?: boolean;
}
var gulpIf: GulpIf;
export = gulpIf;
}