mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
add regexgen support (#47096)
This commit is contained in:
parent
24f1e8d601
commit
384aa8b545
20
types/regexgen/index.d.ts
vendored
Normal file
20
types/regexgen/index.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
// Type definitions for regexgen 1.3
|
||||
// Project: https://github.com/devongovett/regexgen
|
||||
// Definitions by: Septs <https://github.com/septs>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 4.0
|
||||
|
||||
declare function regexgen(inputs: string[], flags?: RegExp['flags']): RegExp;
|
||||
|
||||
declare namespace regexgen {
|
||||
class Trie {
|
||||
add(input: string): void;
|
||||
addAll(inputs: string[]): void;
|
||||
minimize(): void;
|
||||
|
||||
toString(flags?: RegExp['flags']): string;
|
||||
toRegExp(flags?: RegExp['flags']): RegExp;
|
||||
}
|
||||
}
|
||||
|
||||
export = regexgen;
|
||||
8
types/regexgen/regexgen-tests.ts
Normal file
8
types/regexgen/regexgen-tests.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import regexgen = require('regexgen');
|
||||
|
||||
regexgen(['foobar', 'foobaz', 'foozap', 'fooza']);
|
||||
|
||||
const t = new regexgen.Trie();
|
||||
t.add('foobar');
|
||||
t.add('foobaz');
|
||||
t.toRegExp();
|
||||
16
types/regexgen/tsconfig.json
Normal file
16
types/regexgen/tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "regexgen-tests.ts"]
|
||||
}
|
||||
3
types/regexgen/tslint.json
Normal file
3
types/regexgen/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user