2 module.exports = function (x) {
3 var lf = typeof x === 'string' ? '\n' : '\n'.charCodeAt();
4 var cr = typeof x === 'string' ? '\r' : '\r'.charCodeAt();
6 if (x[x.length - 1] === lf) {
7 x = x.slice(0, x.length - 1);
10 if (x[x.length - 1] === cr) {
11 x = x.slice(0, x.length - 1);