diff --git a/glob-expand/glob-expand-tests.ts b/glob-expand/glob-expand-tests.ts new file mode 100644 index 000000000..fc17e5fea --- /dev/null +++ b/glob-expand/glob-expand-tests.ts @@ -0,0 +1,22 @@ +/// + +import * as expand from "glob-expand"; + +expand({ filter: 'isFile', cwd: '../' }, ['**/*.*', '!exclude/these/**/*.*']); +// returns all files in cwd ['file1', 'file2',...] but excluding +// those under directory 'exclude/these' + +// These are the same +expand({ cwd: '../..' }, ['**/*.*', '!node_modules/**/*.*']); +expand({ cwd: '../..' }, '**/*.*', '!node_modules/**/*.*'); + +// These are the same too: +expand({}, ['**/*.*', '!**/*.js']); +expand({}, '**/*.*', '!**/*.js'); +expand(['**/*.*', '!**/*.js']); +expand('**/*.*', '!**/*.js'); + +// Using Regular Expressions: +expand('**/*.js', /.*\.(coffee\.md|litcoffee|coffee)$/i, '!DRAFT*.*'); +// -> returns all `.js`, `.coffee`, `.coffee.md` & `.litcoffee` files, +// excluding those starting with 'DRAFT' diff --git a/glob-expand/glob-expand.d.ts b/glob-expand/glob-expand.d.ts new file mode 100644 index 000000000..0e1258279 --- /dev/null +++ b/glob-expand/glob-expand.d.ts @@ -0,0 +1,27 @@ +// Type definitions for glob-expand +// Project: https://github.com/anodynos/node-glob-expand +// Definitions by: vvakame +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "glob-expand" { + import * as _glob from "glob"; + + interface Option { + filter?: string | ((filePath: string) => boolean); + cwd?: string; + } + + module expand { + var glob: typeof _glob; + var VERSION: string; + } + + function expand(opts: Option, patterns: (string | RegExp)[]): string[]; + function expand(opts: Option, ...patterns: (string | RegExp)[]): string[]; + function expand(patterns: (string | RegExp)[]): string[]; + function expand(...patterns: (string | RegExp)[]): string[]; + + export = expand; +}