Interface CleanParamsOptions<T>

Options for the cleanParams function.

interface CleanParamsOptions<T> {
    filter: CleanParamsOption<T>;
    filter2?: CleanParamsOption<T>;
    removeNo?: CleanParamsOption<T>;
    removeYes?: CleanParamsOption<T>;
    trim: CleanParamsOption<T>;
}

Type Parameters

  • T extends Record<string, string>

Properties

Options for filtering null/undefined/empty string parameters.

  • Passing true will remove all parameters that are null or empty.
  • Passing a string will remove the parameter with that key if it is null or empty.
  • Passing a string array will remove parameters with keys in the array that are null or empty.
filter2?: CleanParamsOption<T>

A second pass of null/undefined/empty string removal is run after all other cleaning operations. This ensures no empty parameters are left behind. If filter is supplied, it will be used for this value. If set to false, no second pass will be performed.

removeNo?: CleanParamsOption<T>

Options for removing values with no-like values.

  • Passing true will remove all parameters with no-like values.
  • Passing a string will remove the parameter with that key if it has a no-like value.
  • Passing a string array will remove all parameters in that array if it has a no-like value.
removeYes?: CleanParamsOption<T>

Options for removing values with yes-like values.

  • Passing true will remove all parameters with yes-like values.
  • Passing a string will remove the parameter with that key if it has a yes-like value.
  • Passing a string array will remove all parameters in that array if it has a yes-like value.

Options for trimming parameters.

  • Passing true will trim all parameters.
  • Passing a string will trim only the parameter with that key.
  • Passing a string array will trim all parameters with keys in the array.

If a parameter cannot be trimmed (no trim function, is null or undefined, etc.), this operation silently fails.