Skip to content

Commit 7f09a53

Browse files
authored
Synchronize function parameter names with typings (#283)
1 parent d40d91d commit 7f09a53

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

index.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ function parseValue(value, options) {
214214
return value;
215215
}
216216

217-
function parse(input, options) {
217+
function parse(query, options) {
218218
options = Object.assign({
219219
decode: true,
220220
sort: true,
@@ -231,17 +231,17 @@ function parse(input, options) {
231231
// Create an object with no prototype
232232
const ret = Object.create(null);
233233

234-
if (typeof input !== 'string') {
234+
if (typeof query !== 'string') {
235235
return ret;
236236
}
237237

238-
input = input.trim().replace(/^[?#&]/, '');
238+
query = query.trim().replace(/^[?#&]/, '');
239239

240-
if (!input) {
240+
if (!query) {
241241
return ret;
242242
}
243243

244-
for (const param of input.split('&')) {
244+
for (const param of query.split('&')) {
245245
let [key, value] = splitOnFirst(options.decode ? param.replace(/\+/g, ' ') : param, '=');
246246

247247
// Missing `=` should be `null`:
@@ -337,41 +337,41 @@ exports.stringify = (object, options) => {
337337
}).filter(x => x.length > 0).join('&');
338338
};
339339

340-
exports.parseUrl = (input, options) => {
340+
exports.parseUrl = (url, options) => {
341341
options = Object.assign({
342342
decode: true
343343
}, options);
344344

345-
const [url, hash] = splitOnFirst(input, '#');
345+
const [url_, hash] = splitOnFirst(url, '#');
346346

347347
return Object.assign(
348348
{
349-
url: url.split('?')[0] || '',
350-
query: parse(extract(input), options)
349+
url: url_.split('?')[0] || '',
350+
query: parse(extract(url), options)
351351
},
352352
options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {}
353353
);
354354
};
355355

356-
exports.stringifyUrl = (input, options) => {
356+
exports.stringifyUrl = (object, options) => {
357357
options = Object.assign({
358358
encode: true,
359359
strict: true
360360
}, options);
361361

362-
const url = removeHash(input.url).split('?')[0] || '';
363-
const queryFromUrl = exports.extract(input.url);
362+
const url = removeHash(object.url).split('?')[0] || '';
363+
const queryFromUrl = exports.extract(object.url);
364364
const parsedQueryFromUrl = exports.parse(queryFromUrl, {sort: false});
365365

366-
const query = Object.assign(parsedQueryFromUrl, input.query);
366+
const query = Object.assign(parsedQueryFromUrl, object.query);
367367
let queryString = exports.stringify(query, options);
368368
if (queryString) {
369369
queryString = `?${queryString}`;
370370
}
371371

372-
let hash = getHash(input.url);
373-
if (input.fragmentIdentifier) {
374-
hash = `#${encode(input.fragmentIdentifier, options)}`;
372+
let hash = getHash(object.url);
373+
if (object.fragmentIdentifier) {
374+
hash = `#${encode(object.fragmentIdentifier, options)}`;
375375
}
376376

377377
return `${url}${queryString}${hash}`;

0 commit comments

Comments
 (0)