An open API service indexing awesome lists of open source software.

https://github.com/karmaniverous/chain-replace

Apply a chain of replacements to a string.
https://github.com/karmaniverous/chain-replace

regex

Last synced: 9 months ago
JSON representation

Apply a chain of replacements to a string.

Awesome Lists containing this project

README

          

# chain-replace

To install:

```bash
npm install @karmaniverous/chain-replace
```

To import:

```js
import { chainReplace } from '@karmaniverous/chain-replace`;
```

See
[tests](https://github.com/karmaniverous/chain-replace/blob/main/lib/chainReplace/chainReplace.test.js)
for examples of usage!

# API Documentation

## chainReplace(input, [replacements]) ⇒ string
Apply a chain of replacements to a string.

**Kind**: global function
**Returns**: string - String result of chained replacements.

| Param | Type | Description |
| --- | --- | --- |
| input | string | Input string. |
| [replacements] | Array.<Array.<(string\|Object), string>> | Replacements array of [pattern: string\|RegExp, replacement: string]. |

---

See more great templates and other tools on
[my GitHub Profile](https://github.com/karmaniverous)!