top of page
Search

Inline or Brenching

  • Writer: Siarhei Korsik
    Siarhei Korsik
  • Jul 6, 2022
  • 1 min read

Updated: Jul 28, 2022

This:

if (filename) {
  if (filename.toLowerCase().endsWith('.csv')) {
    return filename
  } else {
    return `${filename}.csv`
  }
} else {
  return 'export.csv'
}

or this:

return filename ? (filename.toLowerCase().endsWith('.csv') ? filename : `${filename}.csv`) : 'export.csv'

?

 
 
 

Recent Posts

See All
Refactoring. Part I

Hi everyone! This article will be dedicated to refactoring and clean code practices. Let's start with the task I kindly took from the...

 
 
 
If startup - only your own.

I did. 3 developers 4 applications (2 web + 2 mobile) with complex UI and sofisticared payments handling. In 5 months.. Pros Learning...

 
 
 
ССС rule

TL;TR Coffee, Code review, Coding It's really good behaviour (ok, Coffee just for third C, can be anything) that help to move project...

 
 
 

Comments


Made to Be remembered

Menu

clean code

© 2023 by Dev in Wien.

bottom of page