function trim(string) {
    return String(string).replace(/^ +| +$/g, '');
  }
Removes leading and trailing whitespace from a string.

@private
@param {string} string The string to trim.
@returns {string} The trimmed string.