File tree Expand file tree Collapse file tree 3 files changed +9
-12
lines changed Expand file tree Collapse file tree 3 files changed +9
-12
lines changed Original file line number Diff line number Diff line change 11export var canUseDOM = ! ! (
2- ( typeof window !== 'undefined' &&
3- window . document && window . document . createElement )
2+ typeof window !== 'undefined' && window . document && window . document . createElement
43) ;
54
65export function getHashPath ( ) {
7- return decodeURI (
8- // We can't use window.location.hash here because it's not
9- // consistent across browsers - Firefox will pre-decode it!
10- window . location . href . split ( '#' ) [ 1 ] || ''
11- ) ;
6+ // We can't use window.location.hash here because it's not
7+ // consistent across browsers - Firefox will pre-decode it!
8+ return window . location . href . split ( '#' ) [ 1 ] || '' ;
129}
1310
1411export function replaceHashPath ( path ) {
Original file line number Diff line number Diff line change @@ -116,9 +116,9 @@ export function matchPattern(pattern, pathname) {
116116
117117 var remainingPathname , paramValues ;
118118 if ( match != null ) {
119- paramValues = Array . prototype . slice . call ( match , 1 ) . map (
120- ( v ) => v != null ? decodeURIComponent ( v ) : v
121- ) ;
119+ paramValues = Array . prototype . slice . call ( match , 1 ) . map ( function ( v ) {
120+ return v != null ? decodeURIComponent ( v ) : v ;
121+ } ) ;
122122
123123 if ( captureRemaining ) {
124124 remainingPathname = paramValues . pop ( ) ;
@@ -177,7 +177,7 @@ export function formatPattern(pattern, params) {
177177 ) ;
178178
179179 if ( paramValue != null )
180- pathname += paramValue ;
180+ pathname += encodeURIComponent ( paramValue ) ;
181181 } else if ( token === '(' ) {
182182 parenCount += 1 ;
183183 } else if ( token === ')' ) {
Original file line number Diff line number Diff line change @@ -264,7 +264,7 @@ describe('formatPattern', function () {
264264
265265 describe ( 'when a pattern has one splat' , function ( ) {
266266 it ( 'returns the correct path' , function ( ) {
267- expect ( formatPattern ( '/a/*/d' , { splat : 'b/c' } ) ) . toEqual ( '/a/b/c /d' ) ;
267+ expect ( formatPattern ( '/a/*/d' , { splat : 'b/c' } ) ) . toEqual ( '/a/b%2Fc /d' ) ;
268268 } ) ;
269269 } ) ;
270270
You can’t perform that action at this time.
0 commit comments