iansinnott / iansinnott/react-string-replace

Support for running a callback for non-matches

未关闭
#23 7 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
discussion enhancement help wanted
主要语言
JavaScript
星标
666
派生
54
PR 合并指标
30 天内没有已合并 PR

描述

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);
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。