You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
377 B
13 lines
377 B
'use strict'; |
|
module.exports = string => string.replace(/^[\r\n]+/, '').replace(/[\r\n]+$/, ''); |
|
module.exports.start = string => string.replace(/^[\r\n]+/, ''); |
|
|
|
module.exports.end = string => { |
|
let end = string.length; |
|
|
|
while (end > 0 && (string[end - 1] === '\r' || string[end - 1] === '\n')) { |
|
end--; |
|
} |
|
|
|
return end < string.length ? string.slice(0, end) : string; |
|
};
|
|
|