@@ -29,27 +29,31 @@ function isAncestorFiles(filePath) {
29
29
}
30
30
31
31
/**
32
- * @param {function } f - A function.
33
- * @param {function } g - A function.
34
- * @returns {function } A logical-and function of `f` and `g`.
32
+ * @param {(filePath: string) => boolean } f - A function.
33
+ * @param {(filePath: string) => boolean } g - A function.
34
+ * @returns {(filePath: string) => boolean } A logical-and function of `f` and `g`.
35
35
*/
36
36
function and ( f , g ) {
37
37
return filePath => f ( filePath ) && g ( filePath )
38
38
}
39
39
40
40
/**
41
- * @param {function } f - A function.
42
- * @param {function } g - A function.
43
- * @param {function|null } h - A function.
44
- * @returns {function } A logical-or function of `f`, `g`, and `h`.
41
+ * @param {(filePath: string) => boolean } f - A function.
42
+ * @param {(filePath: string) => boolean } g - A function.
43
+ * @param {(filePath: string) => boolean } [h] - A function.
44
+ * @returns {(filePath: string) => boolean } A logical-or function of `f`, `g`, and `h`.
45
45
*/
46
46
function or ( f , g , h ) {
47
- return filePath => f ( filePath ) || g ( filePath ) || ( h && h ( filePath ) )
47
+ if ( h == null ) {
48
+ return filePath => f ( filePath ) || g ( filePath )
49
+ }
50
+
51
+ return filePath => f ( filePath ) || g ( filePath ) || h ( filePath )
48
52
}
49
53
50
54
/**
51
- * @param {function } f - A function.
52
- * @returns {function } A logical-not function of `f`.
55
+ * @param {(filePath: string) => boolean } f - A function.
56
+ * @returns {(filePath: string) => boolean } A logical-not function of `f`.
53
57
*/
54
58
function not ( f ) {
55
59
return filePath => ! f ( filePath )
@@ -59,7 +63,7 @@ function not(f) {
59
63
* Creates a function which checks whether or not a given file is ignoreable.
60
64
*
61
65
* @param {object } p - An object of package.json.
62
- * @returns {function } A function which checks whether or not a given file is ignoreable.
66
+ * @returns {(filePath: string) => boolean } A function which checks whether or not a given file is ignoreable.
63
67
*/
64
68
function filterNeverIgnoredFiles ( p ) {
65
69
const basedir = path . dirname ( p . filePath )
0 commit comments