UNPKG

961 BMarkdownView Raw
1# Installation
2> `npm install --save @types/safe-regex`
3
4# Summary
5This package contains type definitions for safe-regex (https://github.com/davisjam/safe-regex).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/safe-regex.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/safe-regex/index.d.ts)
10````ts
11/**
12 * Checks if a regex is safe to use in order to prevent catastrophic backtracking.
13 * @param re can be a RegExp object or just a string.
14 * @param opts Options for the check.
15 * `limit` - maximum number of allowed repetitions in the entire regex. Default: `25`.
16 */
17declare function safe(re: string | RegExp, opts?: { limit?: number }): boolean;
18
19export = safe;
20
21````
22
23### Additional Details
24 * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
25 * Dependencies: none
26
27# Credits
28These definitions were written by [Rodry](https://github.com/ImRodry).
29
\No newline at end of file