Closed larsgw closed 5 years ago
On the other hand, there's verbosity.
let option = Array.isArray(options.thisOption) ? options.thisOption : [options.thisOption]
and
let option = options.thisOption
option = Array.isArray(option) ? option : [option]
are both pretty verbose, and duplicated code.
Throughout the repository,
[].concat(param)
is used quite a lot for parameters or other options that can either be a certain type, or an array of that type.Array#concat()
normalises this, but in an implicit way. Making this explicit, either with an if-statement or the ternary operator, depending on the context, will improve readability and as a bonus will make code coverage tools be able to work more precisely.