New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

condense-whitespace

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

condense-whitespace - npm Package Compare versions

Comparing version

to
2.0.0

index.d.ts

7

index.js
'use strict';
module.exports = function (str, opts) {
if (typeof str !== 'string') {
module.exports = string => {
if (typeof string !== 'string') {
throw new TypeError('Expected a string');
}
return str.trim().replace(/\s{2,}/g, ' ');
return string.trim().replace(/\s{2,}/g, ' ');
};
{
"name": "condense-whitespace",
"version": "1.0.0",
"description": "Remove leading, trailing and repeated whitespace from a string",
"license": "MIT",
"repository": "sindresorhus/condense-whitespace",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "node test.js"
},
"files": [
"index.js"
],
"keywords": [
"whitespace",
"space",
"condense",
"collapse",
"compact",
"repeated",
"string",
"str",
"trim",
"remove",
"strip"
],
"devDependencies": {
"ava": "0.0.4"
}
"name": "condense-whitespace",
"version": "2.0.0",
"description": "Remove leading, trailing, and repeated whitespace from a string",
"license": "MIT",
"repository": "sindresorhus/condense-whitespace",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"whitespace",
"space",
"condense",
"collapse",
"compact",
"repeated",
"string",
"trim",
"remove",
"strip"
],
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}
# condense-whitespace [![Build Status](https://travis-ci.org/sindresorhus/condense-whitespace.svg?branch=master)](https://travis-ci.org/sindresorhus/condense-whitespace)
> Remove leading, trailing and repeated whitespace from a string
> Remove leading, trailing, and repeated whitespace from a string

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

```
$ npm install --save condense-whitespace
$ npm install condense-whitespace
```

@@ -17,3 +17,3 @@

```js
var condenseWhitespace = require('condense-whitespace');
const condenseWhitespace = require('condense-whitespace');

@@ -25,4 +25,9 @@ condenseWhitespace(' foo bar baz ');

## Related
- [`trim-repeated`](https://github.com/sindresorhus/trim-repeated) - Trim a consecutively repeated substring: `foo--bar---baz` → `foo-bar-baz`
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)

Sorry, the diff of this file is not supported yet