iansinnott / iansinnott/react-string-replace
Natural index numbers on callback function
未关闭
- 主要语言
- 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 还没有评估数据。