File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 11import parse from './parse/index.js' ;
22
3- const isEncoded = ( serverVariable ) => {
3+ const isEncoded = ( serverVariableValue ) => {
44 try {
55 return (
6- typeof serverVariable === 'string' && decodeURIComponent ( serverVariable ) !== serverVariable
6+ typeof serverVariableValue === 'string' &&
7+ decodeURIComponent ( serverVariableValue ) !== serverVariableValue
78 ) ;
89 } catch {
910 return false ;
1011 }
1112} ;
1213
13- export const encodeServerVariable = ( serverVariable ) => {
14- if ( isEncoded ( serverVariable ) ) {
15- return serverVariable ;
14+ export const encodeServerVariable = ( serverVariableValue ) => {
15+ if ( isEncoded ( serverVariableValue ) ) {
16+ return serverVariableValue ;
1617 }
1718
18- return encodeURIComponent ( serverVariable ) . replace ( / % 5 B / g, '[' ) . replace ( / % 5 D / g, ']' ) ;
19+ return encodeURIComponent ( serverVariableValue ) . replace ( / % 5 B / g, '[' ) . replace ( / % 5 D / g, ']' ) ;
1920} ;
2021
2122const significantTypes = [ 'literals' , 'server-variable-name' ] ;
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import parse from './parse/index.js';
33/**
44 * Test if a string is a server URL template.
55 *
6- * @param {string } str
6+ * @param {string } serverURLTemplate
77 * @param {Object } [options={}] - An object.
88 * @param {boolean } [options.strict=true] - A boolean indicating presence of at least one `Server Variable` AST node.
99 * @returns {boolean }
You can’t perform that action at this time.
0 commit comments