hmm this seems a bit extreme, I'd just do `str.replace(/^\s+|\s+$/g, '')`