enhance splitArray to accept multiple splitting dimensions