3 ms·
Here's the complete source for anyone curious ``` exports = module.exports = trim; function trim(str){ return str.replace(/^\s|\s$/g, ''); } exports.left =
by delfaras 7y ago
Here's the complete source for anyone curious
```
exports = module.exports = trim;
function trim(str){
return str.replace(/^\s|\s$/g, '');
}
exports.left = function(str){
return str.replace(/^\s/, '');
};
exports.right = function(str){
return str.replace(/\s$/, '');
};
```
- rjmunro 7y agoThat code doesn't match what actually happens. It will only trim a single character. Have asterisks been trimmed in your copy-paste or something?
- delfaras 7y agoAh you're right, the asterisks have been interpreted as italics. Can't edit my comment, sorry Here's a paste: https://pastebin.com/kBHprdyj https://pastebin.com/kBHprdyj