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 - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

21

index.js

@@ -1,27 +0,8 @@

/**
* @author Titus Wormer
* @copyright 2015 Titus Wormer
* @license MIT
* @module collapse-white-space
* @fileoverview Replace multiple white-space characters
* with a single space.
*/
'use strict';
/* Expose. */
module.exports = collapse;
/**
* Replace multiple white-space characters with a single space.
*
* @example
* collapse(' \t\nbar \nbaz\t'); // ' bar baz '
*
* @param {string} value - Value with uncollapsed white-space,
* coerced to string.
* @return {string} - Value with collapsed white-space.
*/
/* collapse(' \t\nbar \nbaz\t'); // ' bar baz ' */
function collapse(value) {
return String(value).replace(/\s+/g, ' ');
}

43

package.json
{
"name": "collapse-white-space",
"version": "1.0.2",
"version": "1.0.3",
"description": "Replace multiple white-space characters with a single space",

@@ -11,6 +11,3 @@ "license": "MIT",

],
"files": [
"index.js"
],
"repository": "https://github.com/wooorm/collapse-white-space",
"repository": "wooorm/collapse-white-space",
"bugs": "https://github.com/wooorm/collapse-white-space/issues",

@@ -21,17 +18,17 @@ "author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",

],
"files": [
"index.js"
],
"dependencies": {},
"devDependencies": {
"browserify": "^13.0.1",
"browserify": "^14.0.0",
"esmangle": "^1.0.1",
"nyc": "^7.0.0",
"remark-cli": "^1.0.0",
"remark-comment-config": "^4.0.0",
"remark-github": "^5.0.0",
"remark-lint": "^4.0.0",
"remark-validate-links": "^4.0.0",
"nyc": "^11.0.0",
"remark-cli": "^3.0.0",
"remark-preset-wooorm": "^3.0.0",
"tape": "^4.0.0",
"xo": "^0.16.0"
"xo": "^0.18.0"
},
"scripts": {
"build-md": "remark . --quiet --frail",
"build-md": "remark . -qfo",
"build-bundle": "browserify index.js --bare -s collapseWhiteSpace > collapse-white-space.js",

@@ -47,19 +44,15 @@ "build-mangle": "esmangle collapse-white-space.js > collapse-white-space.min.js",

"space": true,
"esnext": false,
"rules": {
"capitalized-comments": "off"
},
"ignores": [
"collapse-white-space.js",
"collapse-white-space.min.js"
"collapse-white-space.js"
]
},
"remarkConfig": {
"output": true,
"plugins": [
"comment-config",
"github",
"lint",
"validate-links"
],
"settings": {
"bullet": "*"
}
"preset-wooorm"
]
}
}
# collapse-white-space [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov]
<!--lint disable heading-increment list-item-spacing no-duplicate-headings-->
Replace multiple white-space characters with a single space.

@@ -17,20 +15,8 @@

Dependencies.
```javascript
var collapse = require('collapse-white-space');
```
Collapse white space:
```javascript
var result = collapse('\tfoo \n\tbar \t\r\nbaz');
collapse('\tfoo \n\tbar \t\r\nbaz'); //=> ' foo bar baz'
```
Yields:
```text
foo bar baz
```
## API

@@ -40,12 +26,4 @@

Replace multiple white-space characters with a single space.
Replace multiple white-space characters in value with a single space.
###### Parameters
* `value` (`string`) — Value with uncollapsed white-space, coerced to string.
###### Returns
`string` — Value with collapsed white-space.
## License

@@ -52,0 +30,0 @@

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