stdlib-js / stdlib-js/stdlib

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

オープン
#3,107 コメント 8 件 リアクション 0 件 担当者 0 名 GitHub で見る
Documentation Help Wanted
主要言語
JavaScript
スター
6k
フォーク
1.3k
平均マージ
1日 3時間
マージ済み PR(30日)
611

説明

### 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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start with the linked @stdlib/regexp/whitespace API documentation and compare its stated behavior with JavaScript's \s character class. Update the documentation to explain the distinction or equivalence, with the work complete when readers can understand why this utility exists; the payload names no source file or test.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
documentation
issue の種類
ドキュメント
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。