iansinnott / iansinnott/react-string-replace

Support for running a callback for non-matches

Aperta
#23 7 commenti 1 reazione 0 assegnatari Vedi su GitHub
discussion enhancement help wanted
Lingua principale
JavaScript
Stelle
666
Fork
54
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

A 4th parameter as callback to process non-match items would be useful.

For instance, in ReactNative, plain text cannot be outside of `` components. The non matches need to be wrapped in a component as well. A callback for these would come quite handy.

Example:
```
const matchCallback = (match, i) => ({match});
const nonMatchCallback = (nonmatch, i) => ({nonmatch});
const components = reactStringReplace(input, regex, matchCallback, nonMatchCallback);
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.