@putout/plugin-apply-starts-with
v1.1.0
Published
šPutout plugin adds ability apply to '.starts.with()'
Downloads
22,458
Maintainers
Readme
@putout/plugin-apply-starts-with
The
startsWith()
method determines whether a string begins with the characters of a specified string, returningtrue
orfalse
as appropriate.(c) MDN
šPutout plugin adds ability to apply .startsWith()
.
Install
npm i @putout/plugin-apply-starts-with
Rule
{
"rules": {
"apply-starts-with": "on"
}
}
ā Example of incorrect code
function x(a = '') {
if (!a.indexOf('1'))
return false;
}
function x1({a = ''}) {
return !a.indexOf('1');
}
function x2() {
const {a = ''} = z;
return !a.indexOf('1');
}
ā Example of correct code
function x(a = '') {
return a.startsWith('1');
}
function x1({a = ''}) {
return a.startsWith('1');
}
function x2() {
const {a = ''} = z;
return a.startsWith('1');
}
License
MIT