@types/to-regex

  • Version 3.0.3
  • Published
  • 6.05 kB
  • No dependencies
  • MIT license

Install

npm i @types/to-regex
yarn add @types/to-regex
pnpm add @types/to-regex

Overview

TypeScript definitions for to-regex

Index

Functions

function makeRe

makeRe: (pattern: string | RegExp, options?: Options) => RegExp;
  • Create a regular expression from the given pattern string.

function toRegex

toRegex: typeof toRegex;
  • Create a regular expression from the given patterns string.

Interfaces

interface Options

interface Options {}

    property cache

    cache?: boolean;
    • Generated regex is cached based on the provided string and options. As a result, runtime compilation only happens once per pattern (as long as options are also the same), which can result in dramatic speed improvements.

      This also helps with debugging, since adding options and pattern are added to the generated regex. true

    property contains

    contains?: boolean;
    • Generate a regex that will match any string that contains the given pattern. By default, regex is strict will only return true for exact matches.

    property flags

    flags?: string;
    • Define the flags you want to use on the generated regex.

    property negate

    negate?: boolean;
    • Create a regex that will match everything except the given pattern.

    property nocase

    nocase?: boolean;
    • Adds the i flag, to enable case-insensitive matching.

    property safe

    safe?: boolean;
    • Check the generated regular expression with safe-regex and throw an error if the regex is potentially unsafe.

    Package Files (1)

    Dependencies (0)

    No dependencies.

    Dev Dependencies (0)

    No dev dependencies.

    Peer Dependencies (0)

    No peer dependencies.

    Badge

    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/to-regex.

    • Markdown
      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/to-regex)
    • HTML
      <a href="https://www.jsdocs.io/package/@types/to-regex"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>