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.
- Host: GitHub
- URL: https://github.com/karmaniverous/chain-replace
- Owner: karmaniverous
- Created: 2022-07-14T07:24:40.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-12T05:57:30.000Z (over 1 year ago)
- Last Synced: 2025-04-05T00:09:46.275Z (9 months ago)
- Topics: regex
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@karmaniverous/chain-replace
- Size: 1.71 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
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)!