[js] cast method for array buffer + array buffer views