Gathering detailed insights and metrics for condense-newlines
Gathering detailed insights and metrics for condense-newlines
Gathering detailed insights and metrics for condense-newlines
Gathering detailed insights and metrics for condense-newlines
Replace extraneous newlines with a single newline, or pass a specified number of newlines to use.
npm install condense-newlines
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
7 Stars
12 Commits
1 Forks
3 Watching
2 Branches
2 Contributors
Updated on 12 Apr 2021
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-7%
193,468
Compared to previous day
Last week
-1%
1,087,802
Compared to previous week
Last month
9%
4,690,502
Compared to previous month
Last year
-9.7%
56,416,520
Compared to previous year
3
2
Replace extraneous newlines with a single newline, or pass a specified number of newlines to use.
Install with npm:
1$ npm install condense-newlines --save
1var condense = require('condense-newlines'); 2console.log(condense('\n\na\n\n\nb\nc\r\n\r\nd\n\n\n')); 3//=> '\na\nb\nc\nd\n';
Specify the separator to use
1console.log(condense('\n\na\n\n\nb\nc\r\n\r\nd\n\n\n', {sep: '\n\n'})); 2//=> '\n\na\n\nb\n\nc\n\nd\n\n';
The minimum number of consecutive newlines to condense.
Default
: 2
1console.log(condense('\n\na\n\n\nb\nc\r\n\r\nd\n\n\n', {min: 2})); 2//=> '\n\na\n\nb\n\nc\n\nd\n\n';
Don't treat whitespace-only lines as newlines.
1console.log(condense('\n\na\n\n \nb\nc\r\n\r\nd\n\n\n', { 2 keepWhitespace: true, sep: '\n\n' 3})); 4 5//=> '\n\na\n\n \nb\n\nc\n\nd\n\n';
You might also be interested in these projects:
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Generate readme and API documentation with verb:
1$ npm install verb && npm run docs
Or, if verb is installed globally:
1$ verb
Install dev dependencies:
1$ npm install -d && npm test
Jon Schlinkert
Copyright © 2016, Jon Schlinkert. Released under the MIT license.
This file was generated by verb, v0.9.0, on April 23, 2016.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/12 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More