export function deepDecodeObject()

in functions/src/shared/encoding.ts [83:106]


export function deepDecodeObject(ob: any): any {
  if (typeof ob !== "object") {
    return ob;
  }

  const toReturn: any = {};
  for (const i in ob) {
    if (!ob.hasOwnProperty(i)) {
      continue;
    }

    const decodedKey = decodeKey(i);

    const val = ob[i];
    if (typeof val == "object" && !Array.isArray(val)) {
      const decodedObject = deepDecodeObject(val);
      toReturn[decodedKey] = decodedObject;
    } else {
      toReturn[decodedKey] = val;
    }
  }

  return toReturn;
}