function applyFilter(filter, input) {
  // find apply function for the specified filter
  let applyFunction
  for (let i = 0; i < filters.length; i++) {
    if (filters[i].name === filter.command || filters[i].alias === filter.command) {
      applyFunction = filters[i].apply
    }
  }

  // return input back as the apply function doesn't exist
  if (!applyFunction) return input

  // apply filter to input, passing in the param
  return applyFunction(input, filter.param)
}
Applies the supplied filter to the input to produce an output.

@param {Object} filter
@param {Array/String} input