mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
add glob-expand
This commit is contained in:
parent
b27d0d0e1c
commit
7283a45802
22
glob-expand/glob-expand-tests.ts
Normal file
22
glob-expand/glob-expand-tests.ts
Normal file
@ -0,0 +1,22 @@
|
||||
/// <reference path="./glob-expand.d.ts" />
|
||||
|
||||
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'
|
||||
27
glob-expand/glob-expand.d.ts
vendored
Normal file
27
glob-expand/glob-expand.d.ts
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
// Type definitions for glob-expand
|
||||
// Project: https://github.com/anodynos/node-glob-expand
|
||||
// Definitions by: vvakame <https://github.com/vvakame/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../glob/glob.d.ts" />
|
||||
|
||||
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;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user