blob: 026559b71f756245c466393285e213bebda20cab [file] [log] [blame]
// Function which converts a protobuf array into an array which can be accessed
// as if it was a protobuf object (with the same keys). If the input is not an
// array it returns itself (since it is called recursively).
export function correctArrayKeys(input) {
if (!Array.isArray(input)) return input;
let object = [];
for (let i = 0; i < input.length; ++i) {
if (input[i] === null) continue;
object[i + 1] = correctArrayKeys(input[i]);
}
return object;
}