mapAssets: mapData ? mapData : {},
district: district,
new_project: new_project,
mrtstns: stations ? true : false,
stations: stations,
beds: beds,
baths: baths,
// eslint will write this
mapAssets: mapData || {},
district,
new_project,
mrtstns: !!stations,
stations,
beds,
baths,
ESLint might suggest simplifying this code by using the Boolean value of stations
directly:
mrtstns: Boolean(stations),
This code assigns the boolean value of stations
to mrtstns
. If stations
is truthy, mrtstns
is set to true
. If stations
is falsy, mrtstns
is set to false
.
Alternatively, ESLint might suggest a simplified version of the ternary operator, like this:
mrtstns: !!stations,
This code assigns the double negation !!
of stations
to mrtstns
. If stations
is truthy, !!stations
evaluates to true
, and mrtstns
is set to true
. If stations
is falsy, !!stations
evaluates to false
, and mrtstns
is set to false
.