Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

string-normalize-space

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-normalize-space

XPath 1.0 normalize-space analog

Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
2
-60%
Maintainers
1
Weekly downloads
 
Created
Source

workflow Jest coverage

string-normalize-space is a node.js module implementing one single function, normalizeSpace, following the definition from XPath 1.0.

So it's basically like String.prototype.trim(), but works also inside the string.

Installation

npm install string-normalize-space

Usage

const {normalizeSpace} = require ('string-normalize-space')

const ab = normalizeSpace (' A\r\n\t B ') // will be 'A B'

Notes

Unlike numerous similar modules, this one doesn't rely on any regular expressions.

As mentioned before, the XPath 1.0 specification is followed, so only 4 characters are considered "space". No effort is made to support extended Unicode space characters.

Keywords

normalize

FAQs

Package last updated on 05 Jan 2024

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