src/main/javascript/utils/APIUtils.js
/**
 * Urlifies a list of parameters to have '/' between them. Ignores nulls or empty.
 *
 * urlify('a', null, 'c', '')  --> 'a/c'
 * @param arguments... A vararg amount of parameters to add '/' between.
 * @return a string with '/' between each element.
 */
Urlifies a list of parameters to have '/' between them. Ignores nulls or empty.
Urlifies a list of parameters to have ' / ' between them . Ignores nulls or empty .
function urlify() {
  if(!arguments || !arguments.length) {
    return null;
  }
  let s = '';
  for(let i = 0; i < arguments.length; i++) {
    const arg = arguments[i];
    if(!arg) {
      continue;
    }
    const isFirstCharSlash = arg.charAt(0) === '/';
    s = s + (s && !isFirstCharSlash ? '/' : '') + arg;
  }
  return s;
}
function urlify ( ) { if ( ! arguments || ! arguments . length ) { return null ; } let s = '' ; for ( let i = 0 ; i < arguments . length ; i ++ ) { const arg = arguments [ i ] ; if ( ! arg ) { continue ; } const isFirstCharSlash = arg . charAt ( 0 ) === '/' ; s = s + ( s && ! isFirstCharSlash ? '/' : '' ) + arg ; } return s ; }
Urlifies a list of parameters to have '/' between them.
Urlifies a list of parameters to have ' / ' between them .