Skip to content

Commit 1d33a3b

Browse files
committed
golf: inline trailing-slash pattern segment;
- from 252 to 249
1 parent 814bf32 commit 1d33a3b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export default function (str) {
1515
pattern += '/' + tmp;
1616
}
1717
}
18-
keys.length && (pattern += '(?:/)?');
18+
1919
return {
2020
keys: keys,
21-
pattern: new RegExp('^' + pattern + '\/?$', 'i')
21+
pattern: new RegExp('^' + pattern + (keys.length ? '(?:/)?' : '') + '\/?$', 'i')
2222
};
2323
}

0 commit comments

Comments
 (0)