(
root: string,
ops: TreeOps,
options: StateFindOptions = {}
)
| 108 | } |
| 109 | |
| 110 | export async function findInTree( |
| 111 | root: string, |
| 112 | ops: TreeOps, |
| 113 | options: StateFindOptions = {} |
| 114 | ): Promise<StateFindEntry[]> { |
| 115 | const results: StateFindEntry[] = []; |
| 116 | const matcher = |
| 117 | options.pathPattern !== undefined ? globToRegex(options.pathPattern) : null; |
| 118 | const nameMatcher = |
| 119 | options.name !== undefined ? globToRegex(options.name) : null; |
| 120 | const types = Array.isArray(options.type) |
| 121 | ? new Set(options.type) |
| 122 | : options.type |
| 123 | ? new Set([options.type]) |
| 124 | : null; |
| 125 | await visitFind( |
| 126 | root, |
| 127 | root, |
| 128 | 0, |
| 129 | ops, |
| 130 | options, |
| 131 | matcher, |
| 132 | nameMatcher, |
| 133 | types, |
| 134 | results |
| 135 | ); |
| 136 | return results; |
| 137 | } |
| 138 | |
| 139 | export function detectFile( |
| 140 | path: string, |
no test coverage detected