Converts anything to string with normalized form. JavaScript equivalent of XSLT normalize-space()
Install
$ npm install --save normalize-space
Usage
The function first converts any incoming value to string then converts all the whitespace characters to a single space.
It works the same way as XSLT normalize-space().
If the incoming parameter is a Node
( result of Document.querySelector() ) or a NodeList
( result of Document.querySelectorAll() ) the module also converts it to string and normalizes its content.
Usage with Node.js
var normalize = ; ;//=> 'a a'
Usage with browser
Use the browser-specific file:
License
normalize-space is licensed under the MIT Open Source license. For more information, see the LICENSE file in this repository.