UNPKG

redos-detector

Version:

A CLI and library which tests helps score how vulnerable a regex pattern is to ReDoS attacks. Supported in the browser, Node and Deno.

10 lines (9 loc) 580 B
import { CapturingGroup, NonCapturingGroup, Reference } from 'regjsparser'; import { MyFeatures, MyRootNode } from './parse'; export type NodeExtra = Readonly<{ capturingGroupToIndex: ReadonlyMap<CapturingGroup<MyFeatures>, number>; indexToCapturingGroup: ReadonlyMap<number, CapturingGroup<MyFeatures>>; nodeToLookaheadStack: ReadonlyMap<CapturingGroup<MyFeatures> | Reference<MyFeatures>, readonly NonCapturingGroup<MyFeatures>[]>; reachableReferences: readonly Reference<MyFeatures>[]; }>; export declare function buildNodeExtra(regexp: MyRootNode): NodeExtra;