iansinnott / iansinnott/react-string-replace
Natural index numbers on callback function
Đang mở
- Ngôn ngữ chính
- JavaScript
- Star
- 666
- Fork
- 54
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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]
})
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.