Last change
on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
315 bytes
|
Rev | Line | |
---|
[6a3a178] | 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 |
|
---|
| 6 | if (x[x.length - 1] === lf) {
|
---|
| 7 | x = x.slice(0, x.length - 1);
|
---|
| 8 | }
|
---|
| 9 |
|
---|
| 10 | if (x[x.length - 1] === cr) {
|
---|
| 11 | x = x.slice(0, x.length - 1);
|
---|
| 12 | }
|
---|
| 13 |
|
---|
| 14 | return x;
|
---|
| 15 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.