import { asyncRegexpReplace } from 'async-regexp-replace';
const source = 'The quick brown fox jumps over the lazy dog';
const result = await asyncRegexpReplace(source, /(brown|lazy)\s/g, async m => {
// The replacer function can be asynchronous
await new Promise(r => setTimeout(r, 0));
return '';
});
// 'The quick fox jumps over the dog'
-
Notifications
You must be signed in to change notification settings - Fork 0
inca/async-regexp-replace
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
String.replace with asynchronous replacer function
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published