This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/strip-eof/index.js

16 lines
315 B
JavaScript
Raw Permalink Normal View History

2019-08-11 18:48:02 +00:00
'use strict';
module.exports = function (x) {
var lf = typeof x === 'string' ? '\n' : '\n'.charCodeAt();
var cr = typeof x === 'string' ? '\r' : '\r'.charCodeAt();
if (x[x.length - 1] === lf) {
x = x.slice(0, x.length - 1);
}
if (x[x.length - 1] === cr) {
x = x.slice(0, x.length - 1);
}
return x;
};