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.

20 lines (19 loc) 876 B
import { ForkableIterator } from 'forkable-iterator'; export type Reader<T, TReturn = void> = Iterator<T, TReturn>; export type ReaderResult<T, TReturn = void> = IteratorResult<T, TReturn>; export declare function emptyReader<T>(): Reader<T>; export type ForkableReader<T, TReturn = void> = ForkableIterator<T, TReturn>; /** * Returns a reader that can be forked with the `fork` function. * * The source reader must not be read from directly. */ export declare function buildForkableReader<T, TReturn = void>(sourceReader: Reader<T, TReturn>): ForkableReader<T, TReturn>; /** * Chains an array of readers together that run consecutively. */ export declare function chainReaders<T>(readers: readonly Reader<T>[]): Reader<T>; /** * Builds a reader that yields each item in the input array. */ export declare function buildArrayReader<T>(input: readonly T[]): Reader<T>;