Socket
Socket
Sign inDemoInstall

strip-eof

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 2.0.0

17

index.js
'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);
module.exports = input => {
const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
const CR = typeof input === 'string' ? '\r' : '\r'.charCodeAt();
if (input[input.length - 1] === LF) {
input = input.slice(0, input.length - 1);
}
if (x[x.length - 1] === cr) {
x = x.slice(0, x.length - 1);
if (input[input.length - 1] === CR) {
input = input.slice(0, input.length - 1);
}
return x;
return input;
};
{
"name": "strip-eof",
"version": "1.0.0",
"description": "Strip the End-Of-File (EOF) character from a string/buffer",
"license": "MIT",
"repository": "sindresorhus/strip-eof",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"strip",
"trim",
"remove",
"delete",
"eof",
"end",
"file",
"newline",
"linebreak",
"character",
"string",
"buffer"
],
"devDependencies": {
"ava": "*",
"xo": "*"
}
"name": "strip-eof",
"version": "2.0.0",
"description": "Strip the final newline character from a string/buffer",
"license": "MIT",
"repository": "sindresorhus/strip-eof",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"strip",
"trim",
"remove",
"delete",
"final",
"last",
"end",
"file",
"newline",
"linebreak",
"character",
"string",
"buffer"
],
"devDependencies": {
"ava": "^0.25.0",
"xo": "^0.23.0"
}
}

@@ -1,2 +0,2 @@

# strip-eof [![Build Status](https://travis-ci.org/sindresorhus/strip-eof.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-eof)
# strip-eof [![Build Status](https://travis-ci.com/sindresorhus/strip-eof.svg?branch=master)](https://travis-ci.com/sindresorhus/strip-eof)

@@ -9,3 +9,3 @@ > Strip the [End-Of-File](https://en.wikipedia.org/wiki/End-of-file) (EOF) character from a string/buffer

```
$ npm install --save strip-eof
$ npm install strip-eof
```

@@ -22,3 +22,3 @@

stripEof(new Buffer('foo\nbar\n\n')).toString();
stripEof(Buffer.from('foo\nbar\n\n')).toString();
//=> 'foo\nbar\n'

@@ -30,2 +30,2 @@ ```

MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc