export function flattenConfig()

in functions/src/shared/encoding.ts [58:78]


export function flattenConfig(ob: any, dir: Direction): StringMap {
  const flattened = flattenObject(ob);
  const result: StringMap = {};
  for (const key in flattened) {
    let newKey = sanitizeKey(key);

    switch (dir) {
      case Direction.ENCODE:
        newKey = encodeKey(newKey);
        break;
      case Direction.DECODE:
        newKey = decodeKey(newKey);
        break;
    }

    const val = flattened[key];
    result[newKey] = val;
  }

  return result;
}