iansinnott / iansinnott/react-string-replace
Natural index numbers on callback function
Abierto
- Lenguaje dominante
- JavaScript
- Estrellas
- 666
- Forks
- 54
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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]
})
```
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.