iansinnott / iansinnott/react-string-replace
Natural index numbers on callback function
Aperta
- Lingua principale
- JavaScript
- Stelle
- 666
- Fork
- 54
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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]
})
```
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.