The
replace()method returns a new string with some or all matches of apatternreplaced by areplacement. The original string is left unchanged.(c) MDN
🐊Putout plugin adds ability to remove useless replace.
Check it out in 🐊Putout Editor.
npm i @putout/plugin-remove-useless-replace
{
"rules": {
"remove-useless-replace": "on"
}
}const a = 'hello'.replace(b, b);const a = 'hello';MIT