sindresorhus/eslint-plugin-unicorn
在 GitHub 查看Enforce `.replaceAll()` over `.split().join()` in `prefer-string-replace-all` rule
Open
#1,441 建立於 2021年7月23日
enhancementhelp wanted
描述
Fail
foo.split('a').join('b');
Pass
foo.replaceAll('a', 'b');
// Not sure about this, maybe add `g` flag, result the same?
foo.split(/a+/).join('b');
// Different with foo.replaceAll('', 'b');
foo.split('').join('b');