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
3.0.0

6

index.d.ts

@@ -6,3 +6,3 @@ /**

```
import condenseWhitespace = require('condense-whitespace');
import condenseWhitespace from 'condense-whitespace';

@@ -13,4 +13,2 @@ condenseWhitespace(' foo bar baz ');

*/
declare function condenseWhitespace(string: string): string;
export = condenseWhitespace;
export default function condenseWhitespace(string: string): string;

@@ -1,9 +0,7 @@

'use strict';
module.exports = string => {
export default function condenseWhitespace(string) {
if (typeof string !== 'string') {
throw new TypeError('Expected a string');
throw new TypeError(`Expected a string, got \`${typeof string}\``);
}
return string.trim().replace(/\s{2,}/g, ' ');
};
return string.trim().replace(/\s{2,}/gu, ' ');
}
{
"name": "condense-whitespace",
"version": "2.0.0",
"version": "3.0.0",
"description": "Remove leading, trailing, and repeated whitespace from a string",
"license": "MIT",
"repository": "sindresorhus/condense-whitespace",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=8"
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},

@@ -35,6 +38,6 @@ "scripts": {

"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
"ava": "^3.15.0",
"tsd": "^0.17.0",
"xo": "^0.44.0"
}
}

@@ -1,6 +0,5 @@

# condense-whitespace [![Build Status](https://travis-ci.org/sindresorhus/condense-whitespace.svg?branch=master)](https://travis-ci.org/sindresorhus/condense-whitespace)
# condense-whitespace
> Remove leading, trailing, and repeated whitespace from a string
## Install

@@ -12,7 +11,6 @@

## Usage
```js
const condenseWhitespace = require('condense-whitespace');
import condenseWhitespace from 'condense-whitespace';

@@ -23,10 +21,4 @@ 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](https://sindresorhus.com)

Sorry, the diff of this file is not supported yet