server.js
function cleanupArray(obj, name) {
    var arr = obj[name];
    if (!arr) throw new Error(name + ' option is missing');
    if (Array.isArray(arr)) {
      arr = arr.join(',');
    }
    if (typeof arr !== 'string') throw new Error(name + ' option must be an Array or a comma separated String');
    arr = arr.replace(/_/g, '-').replace(/\s/g, '').toLowerCase().split(',');
    return arr;
  }
function cleanupArray(obj, name) {
    var arr = obj[name];
    if (!arr) throw new Error(name + ' option is missing');
    if (Array.isArray(arr)) {
      arr = arr.join(',');
    }
    if (typeof arr !== 'string') throw new Error(name + ' option must be an Array or a comma separated String');
    arr = arr.replace(/_/g, '-').replace(/\s/g, '').toLowerCase().split(',');
    return arr;
  }
function cleanupArray ( obj , name ) { var arr = obj [ name ] ; if ( ! arr ) throw new Error ( name + ' option is missing' ) ; if ( Array . isArray ( arr ) ) { arr = arr . join ( ',' ) ; } if ( typeof arr !== 'string' ) throw new Error ( name + ' option must be an Array or a comma separated String' ) ; arr = arr . replace ( / _ / g , '-' ) . replace ( / \s / g , '' ) . toLowerCase ( ) . split ( ',' ) ; return arr ; }
helper function to trim, lowerCase the comma separated string or array
helper function to trim lowerCase the comma separated string or array