collapse-white-space
Advanced tools
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, ' '); | ||
} |
{ | ||
"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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
7
3723
4
6
46
1