UNPKG

368 BJavaScriptView Raw
1'use strict';
2
3module.exports = input => {
4 const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
5 const CR = typeof input === 'string' ? '\r' : '\r'.charCodeAt();
6
7 if (input[input.length - 1] === LF) {
8 input = input.slice(0, input.length - 1);
9 }
10
11 if (input[input.length - 1] === CR) {
12 input = input.slice(0, input.length - 1);
13 }
14
15 return input;
16};