Bug or at least unexpected side effect of replaceAll
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript
- 領域
- tooling
調査の方向性
Start by locating the PureScript strings implementation of replaceAll and its JavaScript replace entry point, then inspect how replacement strings are passed through. Verify the suggested escaping behavior with a regression case involving $' and other dollar-prefixed replacement text; done means replacement strings remain literal.
索引モデルが issue の本文から書いたものです。
説明
In Javascript, the replace function when the first parameter is a Regex, there are special character strings for replacements, e.g. $'.
The problem is that the PureScript replaceAll relies on the JavaScript replace using a Regex with the global flag.
This means that replacement strings are simple string replacements, but instead are interpreted.
Suggested fix:
export const replaceAll = p => r => s => s.replace(new RegExp(p.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"), "g"), r.replace(/\$/g, "$$$$")); // eslint-disable-line no-useless-escape
We're replacing the $ with $$ globally in the replacement string.
- 主要言語
- PureScript
- スター
- 57
- フォーク
- 76
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
purescript/purescript-strings のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
purescript/purescript-strings#171 · コメント 3 件 · リアクション 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
purescript/purescript-strings#170 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
purescript/purescript-strings#169 · コメント 7 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
purescript/purescript-strings#167 · コメント 4 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
purescript/purescript-strings#164 · コメント 2 件 ·
purescript/purescript-strings の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
pastelsky/bundlephobia#1122 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
anthropics/skills#1811 · コメント 1 件 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
CachyOS/distribution#587 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
datalayer/mcp-compose#42 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100