966
967 const availableAdditionalFees = optionalAdditionalFees.filter(
968 (additionalFee) => {
969 if ( 970 additionalFeeTableElement.querySelector( 971 "tbody tr[data-licence-additional-fee-key='" + 972 additionalFee.licenceAdditionalFeeKey + 973 "']" 974 ) 975 ) { 976 return false 977 } 978 return true
979 }
980 )
610 bulmaJS.toggleHtmlClipped();
611 modalElement.querySelector('#additionalFeeAdd--licenceId').value = licenceId;
612 const availableAdditionalFees = optionalAdditionalFees.filter((additionalFee) => {
613 if (additionalFeeTableElement.querySelector("tbody tr[data-licence-additional-fee-key='" + 614 additionalFee.licenceAdditionalFeeKey + 615 "']")) { 616 return false; 617 } 618 return true;
619 });
620 if (availableAdditionalFees.length === 0) {
The following pattern:
if (condition) {
return true
}
return false
can be refactored to:
return condition
When condition
is not a boolean value,
it can be cast into one using the Boolean
constructor.
function isEven(num: number) {
if (num % 2 === 0) return true
return false
}
async function userExists(name: string) {
if (await db.getUser(name)) return true
return false
}
function isEven(num: number) {
return num % 2 === 0
}
async function userExists(name: string) {
return Boolean(await db.getUser(name))
}