1
1
// Type definitions for gulp-if
2
2
// Project: https://github.com/robrich/gulp-if
3
- // Definitions by: Asana <https://asana.com>
3
+ // Definitions by: Asana <https://asana.com>, Joe Skeen <http://github.com/joeskeen>
4
4
// Definitions: https://github.com/borisyankov/DefinitelyTyped
5
5
6
6
/// <reference path="../node/node.d.ts"/>
7
+ /// <reference path="../vinyl/vinyl.d.ts"/>
7
8
8
- declare module "gulp-if" {
9
- function gulpIf (
10
- condition : boolean ,
11
- stream : NodeJS . ReadWriteStream ,
12
- elseStream ?: NodeJS . ReadWriteStream ) : NodeJS . ReadWriteStream ;
9
+ declare module 'gulp-if' {
10
+ import fs = require( 'fs' ) ;
11
+ import vinyl = require( 'vinyl' ) ;
12
+
13
+ interface GulpIf {
14
+ /**
15
+ * gulp-if will pipe data to stream whenever condition is truthy.
16
+ * If condition is falsey and elseStream is passed, data will pipe to elseStream
17
+ * After data is piped to stream or elseStream or neither, data is piped down-stream.
18
+ *
19
+ * @param condition whether input should be piped to stream
20
+ * @param stream the stream to pipe to if condition is true
21
+ * @param elseStream (optional) the stream to pipe to if condition is false
22
+ */
23
+ ( condition : boolean , stream : NodeJS . ReadWriteStream , elseStream ?: NodeJS . ReadWriteStream ) : NodeJS . ReadWriteStream ;
24
+ /**
25
+ * gulp-if will pipe data to stream whenever condition is truthy.
26
+ * If condition is falsey and elseStream is passed, data will pipe to elseStream
27
+ * After data is piped to stream or elseStream or neither, data is piped down-stream.
28
+ *
29
+ * @param condition a Node Stat filter condition to be executed on the vinyl file's Stats object
30
+ * @param stream the stream to pipe to if condition is true
31
+ * @param elseStream (optional) the stream to pipe to if condition is false
32
+ */
33
+ ( condition : StatFilterCondition , stream : NodeJS . ReadWriteStream , elseStream ?: NodeJS . ReadWriteStream ) : NodeJS . ReadWriteStream ;
34
+ /**
35
+ * gulp-if will pipe data to stream whenever condition is truthy.
36
+ * If condition is falsey and elseStream is passed, data will pipe to elseStream
37
+ * After data is piped to stream or elseStream or neither, data is piped down-stream.
38
+ *
39
+ * @param condition a function taking a vinyl file and returning a boolean
40
+ * @param stream the stream to pipe to if condition is true
41
+ * @param elseStream (optional) the stream to pipe to if condition is false
42
+ */
43
+ ( condition : ( fs : vinyl ) => boolean , stream : NodeJS . ReadWriteStream , elseStream ?: NodeJS . ReadWriteStream ) : NodeJS . ReadWriteStream ;
44
+ /**
45
+ * gulp-if will pipe data to stream whenever condition is truthy.
46
+ * If condition is falsey and elseStream is passed, data will pipe to elseStream
47
+ * After data is piped to stream or elseStream or neither, data is piped down-stream.
48
+ *
49
+ * @param condition a RegularExpression that works on the file.path
50
+ * @param stream the stream to pipe to if condition is true
51
+ * @param elseStream (optional) the stream to pipe to if condition is false
52
+ */
53
+ ( condition : RegExp , stream : NodeJS . ReadWriteStream , elseStream ?: NodeJS . ReadWriteStream ) : NodeJS . ReadWriteStream ;
54
+ }
55
+
56
+ interface StatFilterCondition {
57
+ isDirectory ?: boolean ;
58
+ isFile ?: boolean ;
59
+ }
60
+
61
+ var gulpIf : GulpIf ;
62
+
13
63
export = gulpIf ;
14
64
}
0 commit comments