Skip to content

Commit 302a0df

Browse files
committed
Quick fix: normalize regexp spelling across 4.x
1 parent 38b4222 commit 302a0df

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

Readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ toPathRegexp({ id: "abc" }, { validate: false }); //=> "/user/abc"
233233

234234
Path-To-RegExp exposes the two functions used internally that accept an array of tokens.
235235

236-
- `tokensToRegExp(tokens, keys?, options?)` Transform an array of tokens into a matching regular expression.
236+
- `tokensToRegexp(tokens, keys?, options?)` Transform an array of tokens into a matching regular expression.
237237
- `tokensToFunction(tokens)` Transform an array of tokens into a path generator function.
238238

239239
#### Token Information

src/index.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as pathToRegexp from "./index";
33

44
type Test = [
55
pathToRegexp.Path,
6-
(pathToRegexp.RegExpOptions & pathToRegexp.ParseOptions) | undefined,
6+
(pathToRegexp.RegexpOptions & pathToRegexp.ParseOptions) | undefined,
77
pathToRegexp.Token[],
88
Array<
99
[
@@ -2686,7 +2686,7 @@ describe("path-to-regexp", function() {
26862686
const tokens = pathToRegexp.parse(TEST_PATH);
26872687

26882688
it("should expose method to compile tokens to regexp", function() {
2689-
const re = pathToRegexp.tokensToRegExp(tokens);
2689+
const re = pathToRegexp.tokensToRegexp(tokens);
26902690

26912691
expect(exec(re, "/user/123")).toEqual(["/user/123", "123"]);
26922692
});

src/index.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ function regexpToRegexp(path: RegExp, keys?: Key[]): RegExp {
426426
function arrayToRegexp(
427427
paths: Array<string | RegExp>,
428428
keys?: Key[],
429-
options?: RegExpOptions & ParseOptions
429+
options?: RegexpOptions & ParseOptions
430430
): RegExp {
431431
const parts = paths.map(path => pathToRegexp(path, keys, options).source);
432432
return new RegExp(`(?:${parts.join("|")})`, flags(options));
@@ -438,18 +438,18 @@ function arrayToRegexp(
438438
function stringToRegexp(
439439
path: string,
440440
keys?: Key[],
441-
options?: RegExpOptions & ParseOptions
441+
options?: RegexpOptions & ParseOptions
442442
) {
443-
return tokensToRegExp(parse(path, options), keys, options);
443+
return tokensToRegexp(parse(path, options), keys, options);
444444
}
445445

446446
/**
447447
* Expose a function for taking tokens and returning a RegExp.
448448
*/
449-
export function tokensToRegExp(
449+
export function tokensToRegexp(
450450
tokens: Token[],
451451
keys?: Key[],
452-
options: RegExpOptions = {}
452+
options: RegexpOptions = {}
453453
) {
454454
const {
455455
strict,
@@ -515,7 +515,7 @@ export function tokensToRegExp(
515515
return new RegExp(route, flags(options));
516516
}
517517

518-
export interface RegExpOptions {
518+
export interface RegexpOptions {
519519
/**
520520
* When `true` the regexp will be case sensitive. (default: `false`)
521521
*/
@@ -564,7 +564,7 @@ export type Path = string | RegExp | Array<string | RegExp>;
564564
export function pathToRegexp(
565565
path: Path,
566566
keys?: Key[],
567-
options?: RegExpOptions & ParseOptions
567+
options?: RegexpOptions & ParseOptions
568568
) {
569569
if (path instanceof RegExp) {
570570
return regexpToRegexp(path, keys);

0 commit comments

Comments
 (0)