condense-newlines

WebJar for condense-newlines

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

condense-newlines
Last Version

Last Version

0.2.1
Release Date

Release Date

Type

Type

jar
Description

Description

condense-newlines
WebJar for condense-newlines
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/jonschlinkert/condense-newlines

Download condense-newlines

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/condense-newlines/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>condense-newlines</artifactId>
    <version>0.2.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/condense-newlines/
implementation 'org.webjars.npm:condense-newlines:0.2.1'
// https://jarcasting.com/artifacts/org.webjars.npm/condense-newlines/
implementation ("org.webjars.npm:condense-newlines:0.2.1")
'org.webjars.npm:condense-newlines:jar:0.2.1'
<dependency org="org.webjars.npm" name="condense-newlines" rev="0.2.1">
  <artifact name="condense-newlines" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='condense-newlines', version='0.2.1')
)
libraryDependencies += "org.webjars.npm" % "condense-newlines" % "0.2.1"
[org.webjars.npm/condense-newlines "0.2.1"]

Dependencies

compile (3)

Group / Artifact Type Version
org.webjars.npm : extend-shallow jar [2.0.1,3)
org.webjars.npm : is-whitespace jar [0.3.0,0.4)
org.webjars.npm : kind-of jar [3.0.2,4)

Project Modules

There are no modules declared in this project.

condense-newlines NPM version NPM downloads Build Status

Replace extraneous newlines with a single newline, or pass a specified number of newlines to use.

Install

Install with npm:

$ npm install condense-newlines --save

Usage

var condense = require('condense-newlines');
console.log(condense('\n\na\n\n\nb\nc\r\n\r\nd\n\n\n'));
//=> '\na\nb\nc\nd\n';

Options

options.sep

Specify the separator to use

console.log(condense('\n\na\n\n\nb\nc\r\n\r\nd\n\n\n', {sep: '\n\n'}));
//=> '\n\na\n\nb\n\nc\n\nd\n\n';

options.min

The minimum number of consecutive newlines to condense.

Default

: 2

console.log(condense('\n\na\n\n\nb\nc\r\n\r\nd\n\n\n', {min: 2}));
//=> '\n\na\n\nb\n\nc\n\nd\n\n';

options.keepWhitespace

Don't treat whitespace-only lines as newlines.

console.log(condense('\n\na\n\n      \nb\nc\r\n\r\nd\n\n\n', {
  keepWhitespace: true, sep: '\n\n'
}));

//=> '\n\na\n\n      \nb\n\nc\n\nd\n\n';

Related projects

You might also be interested in these projects:

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

Generate readme and API documentation with verb:

$ npm install verb && npm run docs

Or, if verb is installed globally:

$ verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb, v0.9.0, on April 23, 2016.

Versions

Version
0.2.1