e5ca91425cbcd4fdf76862c7ad5772667a8611f9b523cb2a542a34f60593841cb8a991ac1302f2d9e11df21c53c02a8f06223fa0ae99641deedb82f79e1723 368 B

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