Skip to content

Instantly share code, notes, and snippets.

@thegitfather
Created March 18, 2019 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thegitfather/da5659367ffa84308145d638da2dc5e0 to your computer and use it in GitHub Desktop.
Save thegitfather/da5659367ffa84308145d638da2dc5e0 to your computer and use it in GitHub Desktop.
function to return url parameters as a string
_computeSearchUrlParameters(freeTextSearch, originFilter, destinationFilter, quotationStatusFilter) {
const argNames = ['freeTextSearch', 'originFilter', 'destinationFilter', 'quotationStatusFilter'];
let result = '?';
[].forEach.call(arguments, (arg, index) => {
if (arg && arg.length) {
result += argNames[index] + '=' + arg + '&';
}
});
// if some parameter exists then remove last '?' else return null
result = (result.length > 1) ? result.slice(0, -1) : null;
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment