async-regexp-replace
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Async Regexp Replace

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'

Package Sidebar

Install

npm i async-regexp-replace

Weekly Downloads

20

Version

1.1.0

License

ISC

Unpacked Size

3.92 kB

Total Files

4

Last publish

Collaborators

  • inca