Remove duplicate code in toThunk

`Array.isArray(obj)` is contained in both first and last `if` statement. I wonder is this for  performance?