Trim newlines from the start and/or end of a string
$ npm install trim-newlines
const trimNewlines = require('trim-newlines'); trimNewlines('\nš¦\r\n'); //=> 'š¦' trimNewlines.start('\nš¦\r\n'); //=> 'š¦\r\n' trimNewlines.end('\nš¦\r\n'); //=> '\nš¦'
Trim from the start and end of a string.
Trim from the start of a string.
Trim from the end of a string.
String#trim()
but removes only whitespace on the leftString#trim()
but removes only whitespace on the right.MIT Ā© Sindre Sorhus