trim.js 193 B

123456789
  1. /**
  2. * Strip whitespace from the beginning and end of a string
  3. *
  4. * @param str string
  5. * @returns string
  6. */
  7. module.exports = function trim(str) {
  8. return str.replace(/^\s*|\s*$/g, '');
  9. };