Last active
May 1, 2021 21:02
-
-
Save jarble/88bbca5ca291abae540e0c610aae265d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const replaceOnce = require('replace-once'); | |
var str = 'I have a cat, a cathy, and a catch.'; | |
var find = ['cat', 'cathy', 'catch']; | |
var replace = ['catch', 'catch', 'cathy']; | |
console.log(replaceOnce(str, find, replace, 'gi')); | |
//=> 'I have a catch, a catchhy, and a catchch.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment