Skip to content

Commit 7a8d13b

Browse files
committed
Remove unicode character escape classes to support older hermes
1 parent ed36cc2 commit 7a8d13b

File tree

2 files changed

+2
-80
lines changed

2 files changed

+2
-80
lines changed

src/cases.spec.ts

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,6 @@ export const PARSER_TESTS: ParserTestSet[] = [
6464
{ type: "param", name: "_" },
6565
]),
6666
},
67-
{
68-
path: "/:café",
69-
expected: new TokenData([
70-
{ type: "text", value: "/" },
71-
{ type: "param", name: "café" },
72-
]),
73-
},
7467
{
7568
path: '/:"123"',
7669
expected: new TokenData([
@@ -114,13 +107,6 @@ export const STRINGIFY_TESTS: StringifyTestSet[] = [
114107
]),
115108
expected: "/:test",
116109
},
117-
{
118-
data: new TokenData([
119-
{ type: "text", value: "/" },
120-
{ type: "param", name: "café" },
121-
]),
122-
expected: "/:café",
123-
},
124110
{
125111
data: new TokenData([
126112
{ type: "text", value: "/" },
@@ -352,13 +338,6 @@ export const MATCH_TESTS: MatchTestSet[] = [
352338
input: "/route/test",
353339
expected: false,
354340
},
355-
{
356-
input: "/caf%C3%A9",
357-
expected: {
358-
path: "/caf%C3%A9",
359-
params: { test: "café" },
360-
},
361-
},
362341
{
363342
input: "/;,:@&=+$-_.!~*()",
364343
expected: {
@@ -508,13 +487,6 @@ export const MATCH_TESTS: MatchTestSet[] = [
508487
params: { test: "route.json" },
509488
},
510489
},
511-
{
512-
input: "/caf%C3%A9",
513-
expected: {
514-
path: "/caf%C3%A9",
515-
params: { test: "café" },
516-
},
517-
},
518490
],
519491
},
520492
{
@@ -984,56 +956,6 @@ export const MATCH_TESTS: MatchTestSet[] = [
984956
},
985957
],
986958
},
987-
988-
/**
989-
* Unicode matches.
990-
*/
991-
{
992-
path: "/:foo",
993-
tests: [
994-
{
995-
input: "/café",
996-
expected: { path: "/café", params: { foo: "café" } },
997-
},
998-
],
999-
},
1000-
{
1001-
path: "/:foo",
1002-
options: {
1003-
decode: false,
1004-
},
1005-
tests: [
1006-
{
1007-
input: "/caf%C3%A9",
1008-
expected: {
1009-
path: "/caf%C3%A9",
1010-
params: { foo: "caf%C3%A9" },
1011-
},
1012-
},
1013-
],
1014-
},
1015-
{
1016-
path: "/café",
1017-
tests: [
1018-
{
1019-
input: "/café",
1020-
expected: { path: "/café", params: {} },
1021-
},
1022-
],
1023-
},
1024-
{
1025-
path: "/café",
1026-
options: {
1027-
encodePath: encodeURI,
1028-
},
1029-
tests: [
1030-
{
1031-
input: "/caf%C3%A9",
1032-
expected: { path: "/caf%C3%A9", params: {} },
1033-
},
1034-
],
1035-
},
1036-
1037959
/**
1038960
* Hostnames.
1039961
*/

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const DEFAULT_DELIMITER = "/";
22
const NOOP_VALUE = (value: string) => value;
3-
const ID_START = /^[$_\p{ID_Start}]$/u;
4-
const ID_CONTINUE = /^[$\u200c\u200d\p{ID_Continue}]$/u;
3+
const ID_START = /^[$_a-zA-Z]$/u;
4+
const ID_CONTINUE = /^[$\u200c\u200da-zA-Z0-9-]$/u;
55
const DEBUG_URL = "https://git.new/pathToRegexpError";
66

77
/**

0 commit comments

Comments
 (0)