Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
selective-whitespace
Advanced tools
Readme
Condense all whitespace in a string, with options to preserve specific whitespace characters.
$ npm install --save selective-whitespace
var selectiveWhitespace = require('selective-whitespace');
// Condense all whitespace (including \t\n\r)
selectiveWhitespace(' FOO BAR BAZ ');
//=> 'FOO BAR BAZ'
// Condense all whitespace (keep newlines)
selectiveWhitespace('FOO\n BAR\n BAZ\n ', {keep: '\n'});
//=> 'FOO\n BAR\n BAZ\n'
// Condense all whitespace (keep tabs)
selectiveWhitespace('\tFOO \tBAR \tBAZ', {keep: '\t'});
//=> '\tFOO \tBAR \tBAZ'
// Condense all whitespace (keep tabs and newlines)
selectiveWhitespace('\n\tFOO \n\tBAR \n\tBAZ', {keep: '\t,\n'});
//=> '\n\tFOO \n\tBAR \n\tBAZ'
// Strip all whitespace characters
selectiveWhitespace('\t\nFOO \t\nBAR \t\nBAZ', {stripAll:true});
//=> 'FOOBARBAZ'
Required
Type: string
The string you want to condense.
Type: object
Set or override the default options.
Type: string
options: \n\t\r
Comma or pipe-delimited list of values to preserve. You can preserve newlines \n
, tabs \t
or return characters \r
.
Type: Boolean
Default: false
stripAll
mode will remove all whitespace characters from the string.
MIT © Michael Wuergler
FAQs
Condense all string whitespace + options to preserve specific whitespace characters.
The npm package selective-whitespace receives a total of 5,506 weekly downloads. As such, selective-whitespace popularity was classified as popular.
We found that selective-whitespace demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.