stdlib-js / stdlib-js/stdlib

docs: difference between `@stdlib/regexp/whitespace` and `\s`?

Đang mở
#3,107 8 bình luận 0 reaction 0 người được giao Xem trên GitHub
Documentation Help Wanted
Ngôn ngữ chính
JavaScript
Star
6k
Fork
1.3k
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
611

Mô tả

### Description

The [doc of regex/whitespace](https://stdlib.io/docs/api/latest/@stdlib/regexp/whitespace) says:

> Returns a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) to match a [white space](https://en.wikipedia.org/wiki/Whitespace_character) character.

But [\s does the same thing](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Character_classes):

> Matches a single white space character, including space, tab, form feed, line feed, and other Unicode spaces. Equivalent to [\f\n\r\t\v\u0020\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]. For example, /\s\w*/ matches " bar" in "foo bar".

I think an explanation in the doc can be helpful. The git history of the library also doesn't shed any light on the reason. (Perhaps it was created at a time when JS was less powerful?)

### Related Issues

_No response_

### Questions

_No response_

### Demo

_No response_

### Reproduction

```shell

```

### Expected Results

```shell

```

### Actual Results

```shell

```

### Version

_No response_

### Environments

N/A

### Browser Version

_No response_

### Node.js / npm Version

_No response_

### Platform

_No response_

### Checklist

- [x] Read and understood the [Code of Conduct](https://github.com/stdlib-js/stdlib/blob/develop/CODE_OF_CONDUCT.md).
- [x] Searched for existing issues and pull requests.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.