npm.io
1.0.4 • Published 2 years ago

@types/named-regexp-groups

Licence
MIT
Version
1.0.4
Deps
0
Size
4 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/named-regexp-groups

Summary

This package contains type definitions for named-regexp-groups (https://github.com/commenthol/named-regexp-groups/).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/named-regexp-groups.

index.d.ts

interface NamedRegExpExecArray extends RegExpExecArray {
    groups: { [propName: string]: string };
}

declare class NamedRegExp {
    constructor(pattern?: string | RegExp, flags?: string);

    /**
     * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search.
     * @param string The String object or string literal on which to perform the search.
     */
    exec(string: string): NamedRegExpExecArray | null;

    /**
     * Returns a Boolean value that indicates whether or not a pattern exists in a searched string.
     * @param string String on which to perform the search.
     */
    test(string: string): boolean;

    // Non-standard extensions
    toString(): string;

    [Symbol.replace](
        str: string,
        replacement: string | ((match: string, ...capturedGroups: string[]) => string),
    ): string;

    [Symbol.match](str: string): NamedRegExpExecArray;

    [Symbol.split](str: string): string[];

    [Symbol.search](str: string): number;
}

export = NamedRegExp;

Additional Details

  • Last updated: Tue, 07 Nov 2023 0939 GMT
  • Dependencies: none

Credits

These definitions were written by .