iansinnott / iansinnott/react-string-replace

Natural index numbers on callback function

Đang mở
#64 2 bình luận 2 reaction 0 người được giao Xem trên GitHub
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á.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.