Closed elias-winberg closed 7 years ago
is.array(arr) && arr.length > 0 ? arr : []; is logically equivalent is.array(arr) ? arr : [];.
is.array(arr) && arr.length > 0 ? arr : [];
is.array(arr) ? arr : [];
Just a small fix!
It's not entirely equivalent - if arr is [], the former returns a new array, whereas the latter returns a reference to the original array.
arr
[]
@ljharb Ahh, you are right. I didn't think of that. Sorry!
is.array(arr) && arr.length > 0 ? arr : [];
is logically equivalentis.array(arr) ? arr : [];
.Just a small fix!