caolan / forms

An easy way to create, parse and validate forms in node.js
MIT License
1.01k stars 167 forks source link

Remove redundant conditional #196

Closed elias-winberg closed 7 years ago

elias-winberg commented 7 years ago

is.array(arr) && arr.length > 0 ? arr : []; is logically equivalent is.array(arr) ? arr : [];.

Just a small fix!

ljharb commented 7 years ago

It's not entirely equivalent - if arr is [], the former returns a new array, whereas the latter returns a reference to the original array.

elias-winberg commented 7 years ago

@ljharb Ahh, you are right. I didn't think of that. Sorry!