@typed/test
Version:
Testing made simple.
20 lines (16 loc) • 479 B
text/typescript
import * as glob from 'glob'
export function resolveFileGlobs(globs: string[]): Promise<string[]> {
return Promise.all(globs.map(resolveFileGlob)).then(xss =>
xss.reduce((xs, x) => xs.concat(x), []),
)
}
function resolveFileGlob(globPath: string): Promise<string[]> {
return new Promise((resolve, reject) => {
glob(globPath, {}, (err: Error | null, matches: string[]) => {
if (err) {
return reject(err)
}
resolve(matches)
})
})
}