Javascript: wrap Object[] as a return type for methods