restore previous version and put in subfolder

This commit is contained in:
Bernardo
2017-12-18 20:52:01 +01:00
parent 352277ab37
commit db6053938f
4 changed files with 332 additions and 0 deletions

171
types/micromatch/v2/index.d.ts vendored Normal file
View File

@@ -0,0 +1,171 @@
// Type definitions for micromatch 2.3.7
// Project: https://github.com/jonschlinkert/micromatch
// Definitions by: glen-84 <https://github.com/glen-84>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import parseGlob = require('parse-glob');
declare namespace micromatch {
type MatchFunction<T> = ((value: T) => boolean);
type Pattern = (string | RegExp | MatchFunction<string>);
interface Options {
/**
* Normalize slashes in file paths and glob patterns to forward slashes.
*/
unixify?: boolean;
/**
* Match dotfiles. Same behavior as minimatch.
*/
dot?: boolean;
/**
* Unescape slashes in glob patterns. Use cautiously, especially on windows.
*/
unescape?: boolean;
/**
* Remove duplicate elements from the result array.
*/
nodupes?: boolean;
/**
* Allow glob patterns without slashes to match a file path based on its basename. Same behavior as
* minimatch.
*/
matchBase?: boolean;
/**
* Don't expand braces in glob patterns. Same behavior as minimatch nobrace.
*/
nobraces?: boolean;
/**
* Don't expand POSIX bracket expressions.
*/
nobrackets?: boolean;
/**
* Don't expand extended globs.
*/
noextglob?: boolean;
/**
* Use a case-insensitive regex for matching files. Same behavior as minimatch.
*/
nocase?: boolean;
/**
* If true, when no matches are found the actual (array-ified) glob pattern is returned instead of an empty
* array. Same behavior as minimatch.
*/
nonull?: boolean;
/**
* Cache the platform (e.g. win32) to prevent this from being looked up for every file path.
*/
cache?: boolean;
}
interface Glob {
options: micromatch.Options;
pattern: string;
history: { msg: any, pattern: string }[];
tokens: parseGlob.Result;
orig: string;
negated: boolean;
/**
* Initialize defaults.
*/
init(pattern: string): void;
/**
* Push a change into `glob.history`. Useful for debugging.
*/
track(msg: any): void;
/**
* Return true if `glob.pattern` was negated with `!`, also remove the `!` from the pattern.
*/
isNegated(): boolean;
/**
* Expand braces in the given glob pattern.
*/
braces(): void;
/**
* Expand bracket expressions in `glob.pattern`.
*/
brackets(): void;
/**
* Expand extended globs in `glob.pattern`.
*/
extglob(): void;
/**
* Parse the given pattern.
*/
parse(pattern: string): parseGlob.Result;
/**
* Escape special characters in the given string.
*/
escape(pattern: string): string;
/**
* Unescape special characters in the given string.
*/
unescape(pattern: string): string;
}
interface GlobData {
pattern: string;
tokens: parseGlob.Result;
options: micromatch.Options;
}
}
interface Micromatch {
(files: string | string[], patterns: micromatch.Pattern | micromatch.Pattern[]): string[];
isMatch: {
/**
* Returns true if a file path matches the given pattern.
*/
(filePath: string, pattern: micromatch.Pattern, opts?: micromatch.Options): boolean;
/**
* Returns a function for matching.
*/
(filePath: string, opts?: micromatch.Options): micromatch.MatchFunction<string>;
};
/**
* Returns true if any part of a file path matches the given pattern. Think of this as "has path" versus
* "is path".
*/
contains(filePath: string, pattern: micromatch.Pattern, opts?: micromatch.Options): boolean;
/**
* Returns a function for matching using the supplied pattern. e.g. create your own "matcher". The advantage of
* this method is that the pattern can be compiled outside of a loop.
*/
matcher(pattern: micromatch.Pattern): micromatch.MatchFunction<string>;
/**
* Returns a function that can be passed to Array#filter().
*/
filter(patterns: micromatch.Pattern | micromatch.Pattern[], opts?: micromatch.Options): micromatch.MatchFunction<any>;
/**
* Returns true if a file path matches any of the given patterns.
*/
any(filePath: string, patterns: micromatch.Pattern | micromatch.Pattern[], opts?: micromatch.Options): boolean;
/**
* Returns an object with a regex-compatible string and tokens.
*/
expand(pattern: string, opts?: micromatch.Options): micromatch.Glob | micromatch.GlobData;
/**
* Create a regular expression for matching file paths based on the given pattern.
*/
makeRe(pattern: string, opts?: micromatch.Options): RegExp;
}
declare const micromatch: Micromatch;
export = micromatch;

View File

@@ -0,0 +1,54 @@
import mm = require('micromatch');
var strArrResult: string[];
var boolResult: boolean;
var strMatchFuncResult: mm.MatchFunction<string>;
var anyMatchFuncResult: mm.MatchFunction<any>;
var globDataResult: mm.GlobData;
var regExpResult: RegExp;
// Usage.
strArrResult = mm(['a.js', 'b.md', 'c.txt'], '*.{js,txt}');
// Multiple patterns.
strArrResult = mm(['a.md', 'b.js', 'c.txt', 'd.json'], ['*.md', '*.txt']);
// "isMatch" method.
boolResult = mm.isMatch('.verb.md', '*.md');
boolResult = mm.isMatch('.verb.md', '*.md', {dot: true});
boolResult = mm.isMatch('*.md', {dot: true})('.verb.md');
// "contains" method.
boolResult = mm.contains('a/b/c', 'a/b');
boolResult = mm.contains('a/b/c', 'a/b', {dot: true});
// "matcher" method.
strMatchFuncResult = mm.matcher('*.md');
strMatchFuncResult = mm.matcher(/\.md$/);
strMatchFuncResult = mm.matcher((filePath: string) => true);
// "filter" method.
anyMatchFuncResult = mm.filter('*.md');
anyMatchFuncResult = mm.filter(/\.md$/);
anyMatchFuncResult = mm.filter((filePath: string) => true);
anyMatchFuncResult = mm.filter('*.md', {dot: true});
['a.js', 'b.txt', 'c.md'].filter(anyMatchFuncResult);
var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
anyMatchFuncResult = mm.filter(['{1..10}', '![7-9]', '!{3..4}']);
arr.filter(anyMatchFuncResult);
// "any" method.
boolResult = mm.any('abc', ['!*z']);
boolResult = mm.any('abc', 'a*');
boolResult = mm.any('abc', 'a*', {dot: true});
// "expand" method.
globDataResult = mm.expand('*.js');
globDataResult = mm.expand('*.js', {dot: true});
// "makeRe" method.
regExpResult = mm.makeRe('*.js');
regExpResult = mm.makeRe('*.js', {dot: true});

View File

@@ -0,0 +1,28 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../../",
"paths": {
"micromatch": [
"micromatch/v2"
]
},
"typeRoots": [
"../../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"micromatch-tests.ts"
]
}

View File

@@ -0,0 +1,79 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
}
}