⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Releases: iansinnott/react-string-replace

v2.0.1

02 Jan 00:05

Choose a tag to compare

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 test for 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

01 Jan 23:35

Choose a tag to compare

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.


Fixes #32, closes #92

Full Changelog: v1.2.0...v2.0.0

v1.2.0

01 Jan 23:35

Choose a tag to compare

What's Changed

New Features

  • Added optional count parameter 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 count parameter

Full Changelog: v1.1.2...v1.2.0

v1.1.2

01 Jan 23:34

Choose a tag to compare

What's Changed

  • Added sideEffects: false to package.json for better tree-shaking support (#94)

Full Changelog: v1.1.1...v1.1.2

v1.1.1

15 Jun 08:45

Choose a tag to compare

v1.1.0

02 May 16:07

Choose a tag to compare

Changed

  • Fixed issue where undefined in 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

17 Mar 17:48

Choose a tag to compare

1.0

Since the API has long been stable this release simply signifies that fact.

v0.5.0

04 Dec 04:58

Choose a tag to compare

Remove dependencies.

Updated types

22 Apr 04:45

Choose a tag to compare

Add types

30 Mar 03:18

Choose a tag to compare