Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

index.js 315B

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