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.0 to 1.0.1

12

history.md

@@ -1,9 +0,11 @@

---
mdast:
setext: true
---
<!--remark setext-->
<!--lint disable no-multiple-toplevel-headings -->
<!--lint disable no-multiple-toplevel-headings-->
1.0.1 / 2016-07-23
==================
* Rewrite module ([`6d48e8d`](https://github.com/wooorm/collapse-white-space/commit/6d48e8d))
1.0.0 / 2015-07-12
==================

@@ -0,10 +1,15 @@

/**
* @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';
/*
* Constants.
*/
/* Expose. */
module.exports = collapse;
var WHITE_SPACE_COLLAPSABLE = /\s+/g;
var SPACE = ' ';
/**

@@ -21,9 +26,3 @@ * Replace multiple white-space characters with a single space.

function collapse(value) {
return String(value).replace(WHITE_SPACE_COLLAPSABLE, SPACE);
return String(value).replace(/\s+/g, ' ');
}
/*
* Expose.
*/
module.exports = collapse;
{
"name": "collapse-white-space",
"version": "1.0.0",
"version": "1.0.1",
"description": "Replace multiple white-space characters with a single space",

@@ -12,39 +12,52 @@ "license": "MIT",

"files": [
"index.js",
"LICENSE"
"index.js"
],
"repository": {
"type": "git",
"url": "https://github.com/wooorm/collapse-white-space.git"
},
"author": "Titus Wormer <tituswormer@gmail.com>",
"repository": "https://github.com/wooorm/collapse-white-space",
"bugs": "https://github.com/wooorm/collapse-white-space/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)"
],
"dependencies": {},
"devDependencies": {
"browserify": "^10.0.0",
"eslint": "^0.24.0",
"esmangle": "^1.0.0",
"istanbul": "^0.3.0",
"jscs": "^1.0.0",
"jscs-jsdoc": "^1.0.0",
"mdast": "^0.26.0",
"mdast-github": "^0.3.1",
"mdast-lint": "^0.4.1",
"mdast-usage": "^0.3.0",
"mdast-yaml-config": "^0.2.0",
"mocha": "^2.0.0"
"browserify": "^13.0.1",
"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",
"tape": "^4.0.0",
"xo": "^0.16.0"
},
"scripts": {
"test-api": "mocha --check-leaks test.js",
"test-coveralls": "istanbul cover _mocha --report lcovonly -- --check-leaks test.js",
"test-coverage": "istanbul cover _mocha -- --check-leaks test.js",
"test-travis": "npm run test-coveralls",
"test": "npm run test-api",
"lint-api": "eslint .",
"lint-style": "jscs --reporter inline .",
"lint": "npm run lint-api && npm run lint-style",
"make": "npm run lint && npm run test-coverage",
"build-md": "mdast . LICENSE --output --quiet",
"build-md": "remark . --quiet --frail",
"build-bundle": "browserify index.js --bare -s collapseWhiteSpace > collapse-white-space.js",
"postbuild-bundle": "esmangle collapse-white-space.js > collapse-white-space.min.js",
"build": "npm run build-md && npm run build-bundle"
"build-mangle": "esmangle collapse-white-space.js > collapse-white-space.min.js",
"build": "npm run build-md && npm run build-bundle && npm run build-mangle",
"lint": "xo",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run build && npm run lint && npm run test-coverage"
},
"xo": {
"space": true,
"ignores": [
"collapse-white-space.js",
"collapse-white-space.min.js"
]
},
"remarkConfig": {
"output": true,
"plugins": [
"comment-config",
"github",
"lint",
"validate-links"
],
"settings": {
"bullet": "*"
}
}
}

@@ -1,3 +0,5 @@

# collapse-white-space [![Build Status](https://img.shields.io/travis/wooorm/collapse-white-space.svg?style=flat)](https://travis-ci.org/wooorm/collapse-white-space) [![Coverage Status](https://img.shields.io/coveralls/wooorm/collapse-white-space.svg?style=flat)](https://coveralls.io/r/wooorm/collapse-white-space?branch=master)
# 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.

@@ -7,3 +9,3 @@

[npm](https://docs.npmjs.com/cli/install):
[npm][npm-install]:

@@ -14,7 +16,2 @@ ```bash

**collapse-white-space** is also available for [bower](http://bower.io/#install-packages),
[component](https://github.com/componentjs/component), [duo](http://duojs.org/#getting-started),
and for AMD, CommonJS, and globals ([uncompressed](collapse-white-space.js) and
[compressed](collapse-white-space.min.js)).
## Usage

@@ -42,14 +39,53 @@

### collapse(value)
### `collapse(value)`
Replace multiple white-space characters with a single space.
Parameters:
###### Parameters
* `value` (`string`) — Value with uncollapsed white-space, coerced to string.
Returns: `string` — Value with collapsed white-space.
###### Returns
`string` — Value with collapsed white-space.
### `commaSeparated.stringify(values[, options])`
Compile an array of strings to comma-separated tokens.
Handles empty items at start or end correctly.
Note that it’s not possible to specify initial or final
white-space per value.
###### Parameters
* `values` (`Array.<string>`) — List of tokens;
* `options` (`Object`, optional):
* `padLeft` (`boolean`, default: `true`)
— Whether to pad a space before a token;
* `padRight` (`boolean`, default: `false`)
— Whether to pad a space after a token.
###### Returns
`string` — Comma-separated tokens.
## License
[MIT](LICENSE) @ [Titus Wormer](http://wooorm.com)
[MIT][license] © [Titus Wormer][author]
<!-- Definitions -->
[travis-badge]: https://img.shields.io/travis/wooorm/collapse-white-space.svg
[travis]: https://travis-ci.org/wooorm/collapse-white-space
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/collapse-white-space.svg
[codecov]: https://codecov.io/github/wooorm/collapse-white-space
[npm-install]: https://docs.npmjs.com/cli/install
[license]: LICENSE
[author]: http://wooorm.com

Sorry, the diff of this file is not supported yet

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