Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

strip-final-newline

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strip-final-newline - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

10

index.js

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

'use strict';
module.exports = input => {
export default function stripFinalNewline(input) {
const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();

@@ -8,10 +6,10 @@ const CR = typeof input === 'string' ? '\r' : '\r'.charCodeAt();

if (input[input.length - 1] === LF) {
input = input.slice(0, input.length - 1);
input = input.slice(0, -1);
}
if (input[input.length - 1] === CR) {
input = input.slice(0, input.length - 1);
input = input.slice(0, -1);
}
return input;
};
}

13

package.json
{
"name": "strip-final-newline",
"version": "2.0.0",
"version": "3.0.0",
"description": "Strip the final newline character from a string/buffer",
"license": "MIT",
"repository": "sindresorhus/strip-final-newline",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=6"
"node": ">=12"
},

@@ -37,5 +40,5 @@ "scripts": {

"devDependencies": {
"ava": "^0.25.0",
"xo": "^0.23.0"
"ava": "^3.15.0",
"xo": "^0.39.1"
}
}

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

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

@@ -7,3 +7,2 @@ > Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from a string/buffer

## Install

@@ -15,7 +14,6 @@

## Usage
```js
const stripFinalNewline = require('strip-final-newline');
import stripFinalNewline from 'strip-final-newline';

@@ -29,5 +27,12 @@ stripFinalNewline('foo\nbar\n\n');

---
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-strip-eof?utm_source=npm-strip-eof&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc