iansinnott / iansinnott/react-string-replace

Natural index numbers on callback function

未关闭
#64 2 条评论 2 个 reaction 已指派 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 摘要。