Releases: iansinnott/react-string-replace
Releases · iansinnott/react-string-replace
v2.0.1
Tooling Modernization
Switched from npm/yarn to Bun for package management and testing.
Before → After
| Metric | Before | After |
|---|---|---|
| Dev dependencies | 529 packages | 4 packages |
| Test execution | ~2s | 11ms |
| Lockfile size | 410KB | 1KB |
Changes
- Replace npm/yarn with Bun for package management
- Replace AVA with
bun testfor testing (14 tests, same coverage) - Replace CircleCI with GitHub Actions
- Remove ESLint and babel-eslint (deprecated tooling)
No changes to the library code or public API.
Full Changelog: v2.0.0...v2.0.1
v2.0.0
Breaking Changes
Index parameter now starts at 0
The index parameter passed to the replacement callback now returns the logical match index (0, 1, 2, 3...) instead of the internal array index (1, 3, 5, 7...).
Before (v1.x):
reactStringReplace('a b c', /(\w)/g, (match, index) => {
console.log(index); // 1, 3, 5
});After (v2.0):
reactStringReplace('a b c', /(\w)/g, (match, index) => {
console.log(index); // 0, 1, 2
});This makes the index more intuitive and useful for React key props.
Migration
If your code relies on the old index values, update your callback logic to expect 0-indexed sequential values.
Full Changelog: v1.2.0...v2.0.0
v1.2.0
What's Changed
New Features
- Added optional
countparameter to limit the number of replacements (#91)
// Replace only the first match
reactStringReplace('hey hey hey', 'hey', (match) => <span>{match}</span>, 1);
// => ['', <span>hey</span>, ' ', 'hey', ' ', 'hey', '']Bug Fixes
- Fixed crash when using RegExp patterns with the
countparameter
Full Changelog: v1.1.2...v1.2.0
v1.1.2
What's Changed
- Added
sideEffects: falseto package.json for better tree-shaking support (#94)
Full Changelog: v1.1.1...v1.1.2
v1.1.1
- update types (#88 by @zbigniewstefaniuk)
v1.1.0
Changed
- Fixed issue where
undefinedin the results of string.split would throw an error. This depends on the user-passed regex so it only happens sometimes, depending on your regex. can reproduce using two matching groups.
1.0
Since the API has long been stable this release simply signifies that fact.
v0.5.0
Remove dependencies.
Updated types
- Updated typescript types (Thanks @monsterkrampe!)
Add types
- Adds typescript types (6c71cd4) (@jakemmarsh)