You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constreplaceOnce=require('replace-once');varstr='I have a cat, a cathy, and a catch.';varfind=['cat','cathy','catch'];varreplace=['catch','catch','cathy'];console.log(replaceOnce(str,find,replace,'gi'));//=> 'I have a catch, a catchhy, and a catchch.'
The text was updated successfully, but these errors were encountered:
As @jarble brought up in a Stack Overflow Comment, replacements sometimes get made in the wrong order:
The text was updated successfully, but these errors were encountered: