Skip to content

Commit 654edf2

Browse files
committed
Inline a function
1 parent 28c94f0 commit 654edf2

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/url_utils.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,11 @@ const UrlUtils = {
124124
searchUrl += "%s";
125125
}
126126
searchUrl = searchUrl.replace(/%S/g, query);
127-
return searchUrl.replace(/%s/g, this.createSearchQuery(query));
128-
},
129127

130-
// Map a search query to its URL encoded form. E.g. "BBC Sport" -> "BBC%20Sport".
131-
createSearchQuery(query) {
128+
// Map a search query to its URL encoded form. E.g. "BBC Sport" -> "BBC%20Sport".
132129
const parts = query.split(/\s+/);
133-
return parts.map(encodeURIComponent).join("%20");
130+
const encodedQuery = parts.map(encodeURIComponent).join("%20");
131+
return searchUrl.replace(/%s/g, encodedQuery);
134132
},
135133
};
136134

0 commit comments

Comments
 (0)