// FIXME: Update this file to be type safe and remove this and next line // @ts-strict-ignore import { ObservableInput, OperatorFunction, map } from "rxjs"; /** * Converts a record of keys and values into a record preserving the original key and converting each value into an {@link ObservableInput}. * @param project A function to project a given key and value pair into an {@link ObservableInput} */ export function convertValues( project: (key: TKey, value: TInput) => ObservableInput, ): OperatorFunction | null, Record>> { return map((inputRecord) => { if (inputRecord == null) { return null; } // Can't use TKey in here, have to use `PropertyKey` const result: Record> = {}; for (const [key, value] of Object.entries(inputRecord) as [TKey, TInput][]) { result[key] = project(key, value); } return result; }); }