iansinnott / iansinnott/react-string-replace

Natural index numbers on callback function

オープン
#64 コメント 2 件 リアクション 2 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
666
フォーク
54
PR マージ指標
30日以内にマージされた PR はありません

説明

Hi there 👋

I have a situation where I'd like to replace the matched regex with my own array of nodes respectively. It would be great receiving natural index numbers `0, 1, 2` on callback instead of odd ones.

```
const nodes: React.ReactNodeArray

// [
// label,
//

heading


// ]

reactStringReplace('These are my {} and {} and {} values.', /({})/g, (match, i) => {
// odd index numbers
return nodes[(i - 1) / 2]
})
```

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

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

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

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