trim-newlines
Advanced tools
Comparing version 2.0.0 to 3.0.0
'use strict'; | ||
module.exports = x => x.replace(/^[\r\n]+/, '').replace(/[\r\n]+$/, ''); | ||
module.exports.start = x => x.replace(/^[\r\n]+/, ''); | ||
module.exports.end = x => x.replace(/[\r\n]+$/, ''); | ||
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]+$/, ''); |
{ | ||
"name": "trim-newlines", | ||
"version": "2.0.0", | ||
"description": "Trim newlines from the start and/or end of a string", | ||
"license": "MIT", | ||
"repository": "sindresorhus/trim-newlines", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"trim", | ||
"newline", | ||
"newlines", | ||
"linebreak", | ||
"lf", | ||
"crlf", | ||
"left", | ||
"right", | ||
"start", | ||
"end", | ||
"string", | ||
"str", | ||
"remove", | ||
"delete", | ||
"strip" | ||
], | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
} | ||
"name": "trim-newlines", | ||
"version": "3.0.0", | ||
"description": "Trim newlines from the start and/or end of a string", | ||
"license": "MIT", | ||
"repository": "sindresorhus/trim-newlines", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=8" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava && tsd" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"index.d.ts" | ||
], | ||
"keywords": [ | ||
"trim", | ||
"newline", | ||
"newlines", | ||
"linebreak", | ||
"lf", | ||
"crlf", | ||
"left", | ||
"right", | ||
"start", | ||
"end", | ||
"string", | ||
"remove", | ||
"delete", | ||
"strip" | ||
], | ||
"devDependencies": { | ||
"ava": "^1.4.1", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
} | ||
} |
@@ -9,3 +9,3 @@ # trim-newlines [![Build Status](https://travis-ci.org/sindresorhus/trim-newlines.svg?branch=master)](https://travis-ci.org/sindresorhus/trim-newlines) | ||
``` | ||
$ npm install --save trim-newlines | ||
$ npm install trim-newlines | ||
``` | ||
@@ -19,4 +19,10 @@ | ||
trimNewlines('\nunicorn\r\n'); | ||
//=> 'unicorn' | ||
trimNewlines('\n🦄\r\n'); | ||
//=> '🦄' | ||
trimNewlines.start('\n🦄\r\n'); | ||
//=> '🦄\r\n' | ||
trimNewlines.end('\n🦄\r\n'); | ||
//=> '\n🦄' | ||
``` | ||
@@ -27,11 +33,11 @@ | ||
### trimNewlines(input) | ||
### trimNewlines(string) | ||
Trim from the start and end of a string. | ||
### trimNewlines.start(input) | ||
### trimNewlines.start(string) | ||
Trim from the start of a string. | ||
### trimNewlines.end(input) | ||
### trimNewlines.end(string) | ||
@@ -38,0 +44,0 @@ Trim from the end of a string. |
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
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
3700
5
37
53
0
3