trim-newlines
Advanced tools
Comparing version 3.0.0 to 4.0.0
@@ -7,3 +7,3 @@ declare const trimNewlines: { | ||
```js | ||
import trimNewlines = require('trim-newlines'); | ||
import trimNewlines from 'trim-newlines'; | ||
@@ -21,3 +21,3 @@ trimNewlines('\n🦄\r\n'); | ||
```js | ||
import trimNewlines = require('trim-newlines'); | ||
import trimNewlines from 'trim-newlines'; | ||
@@ -35,3 +35,3 @@ trimNewlines.start('\n🦄\r\n'); | ||
```js | ||
import trimNewlines = require('trim-newlines'); | ||
import trimNewlines from 'trim-newlines'; | ||
@@ -45,2 +45,2 @@ trimNewlines.end('\n🦄\r\n'); | ||
export = trimNewlines; | ||
export default trimNewlines; |
10
index.js
@@ -1,4 +0,6 @@ | ||
'use strict'; | ||
module.exports = string => string.replace(/^[\r\n]+/, '').replace(/[\r\n]+$/, ''); | ||
module.exports.start = string => string.replace(/^[\r\n]+/, ''); | ||
module.exports.end = string => string.replace(/[\r\n]+$/, ''); | ||
export default function trimNewlines(string) { | ||
return string.replace(/^[\r\n]+|[\r\n]+$/g, ''); | ||
} | ||
trimNewlines.start = string => string.replace(/^[\r\n]+/, ''); | ||
trimNewlines.end = string => string.replace(/[\r\n]+$/, ''); |
{ | ||
"name": "trim-newlines", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "Trim newlines from the start and/or end of a string", | ||
"license": "MIT", | ||
"repository": "sindresorhus/trim-newlines", | ||
"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": ">=8" | ||
"node": ">=12" | ||
}, | ||
@@ -39,6 +42,6 @@ "scripts": { | ||
"devDependencies": { | ||
"ava": "^1.4.1", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
"ava": "^3.15.0", | ||
"tsd": "^0.14.0", | ||
"xo": "^0.39.1" | ||
} | ||
} |
@@ -1,6 +0,5 @@ | ||
# trim-newlines [![Build Status](https://travis-ci.org/sindresorhus/trim-newlines.svg?branch=master)](https://travis-ci.org/sindresorhus/trim-newlines) | ||
# trim-newlines | ||
> Trim [newlines](https://en.wikipedia.org/wiki/Newline) from the start and/or end of a string | ||
## Install | ||
@@ -12,7 +11,6 @@ | ||
## Usage | ||
```js | ||
const trimNewlines = require('trim-newlines'); | ||
import trimNewlines from 'trim-newlines'; | ||
@@ -29,3 +27,2 @@ trimNewlines('\n🦄\r\n'); | ||
## API | ||
@@ -45,3 +42,2 @@ | ||
## Related | ||
@@ -52,5 +48,12 @@ | ||
--- | ||
## License | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) | ||
<div align="center"> | ||
<b> | ||
<a href="https://tidelift.com/subscription/pkg/npm-trim-newlines?utm_source=npm-trim-newlines&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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4043
38
56
Yes