Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

collapse-white-space

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

collapse-white-space

Collapse white space

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1M
decreased by-58.63%
Maintainers
1
Weekly downloads
 
Created

What is collapse-white-space?

The collapse-white-space npm package is designed to reduce multiple whitespace characters in a string down to a single space, effectively 'collapsing' them. This can be particularly useful for cleaning up strings in web development contexts, such as user input or text content processing, where consistent whitespace handling is desired.

What are collapse-white-space's main functionalities?

Collapsing multiple whitespace characters

This feature allows you to take a string with multiple spaces, tabs, or other whitespace characters and reduce them to a single space between words or characters. It's particularly useful for text normalization.

"use strict";\nconst collapse = require('collapse-white-space');\nconst text = 'This    is  a    test string.';\nconsole.log(collapse(text)); // 'This is a test string.'

Other packages similar to collapse-white-space

Keywords

FAQs

Package last updated on 27 Oct 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc