@types/to-regex
TypeScript definitions for to-regex
Last updated 4 years ago by types .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install @types/to-regex 
SYNC missed versions from official npm registry.

Installation

npm install --save @types/to-regex

Summary

This package contains type definitions for to-regex (https://github.com/jonschlinkert/to-regex).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/to-regex.

index.d.ts

// Type definitions for to-regex 3.0
// Project: https://github.com/jonschlinkert/to-regex
// Definitions by: Rauli Laine <https://github.com/RauliL>
//                 Anatoly Pitikin <https://github.com/xapdkop>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

declare namespace toRegex {
    interface Options {
        /**
         * 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.
         */
        contains?: boolean;

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

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

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

        /**
         * 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.
         * @default true
         */
        cache?: boolean;

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

    /**
     * Create a regular expression from the given `pattern` string.
     */
    function makeRe(pattern: string | RegExp, options?: Options): RegExp;
}

/**
 * Create a regular expression from the given `patterns` string.
 */
declare function toRegex(patterns: string | ReadonlyArray<string> | RegExp, options?: toRegex.Options): RegExp;

export = toRegex;

Additional Details

  • Last updated: Thu, 21 Oct 2021 23:32:00 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Rauli Laine, and Anatoly Pitikin.

Current Tags

  • 3.0.0                                ...           latest (4 years ago)
  • 3.0.0                                ...           ts3.7 (4 years ago)
  • 3.0.0                                ...           ts3.8 (4 years ago)
  • 3.0.0                                ...           ts3.9 (4 years ago)
  • 3.0.0                                ...           ts4.0 (4 years ago)
  • 3.0.0                                ...           ts4.1 (4 years ago)
  • 3.0.0                                ...           ts4.2 (4 years ago)
  • 3.0.0                                ...           ts4.3 (4 years ago)
  • 3.0.0                                ...           ts4.4 (4 years ago)
  • 3.0.0                                ...           ts4.5 (4 years ago)
  • 3.0.0                                ...           ts4.6 (4 years ago)
  • 3.0.0                                ...           ts4.7 (4 years ago)
  • 3.0.0                                ...           ts4.8 (4 years ago)
  • 3.0.0                                ...           ts4.9 (4 years ago)

1 Versions

  • 3.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 1
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org | Home |