@vgerbot/async
    Preparing search index...

    Function mapValues

    • Maps each value of an object asynchronously while preserving original keys.

      Type Parameters

      • T extends Record<string, unknown>

        The input object type.

      • R

        The mapped value type.

      Parameters

      • data: T | Promise<T>

        The object to map, or a promise that resolves to one.

      • callbackfn: (value: T[keyof T], key: keyof T, token: CancellableToken) => Promise<R>

        Async mapper invoked with each value and key.

      • Optionaloptions: MapValuesOptions<R>

        Configuration options, including cancellation and concurrency.

      Returns CancellableHandle<Record<string, R>>

      A cancellable handle that resolves to a mapped object.

      const handle = mapValues(
      { a: 1, b: 2 },
      async (value, key, token) => {
      await token.sleep(10);
      return `${String(key)}:${value * 2}`;
      },
      { concurrency: 2 },
      );

      const result = await handle; // { a: "a:2", b: "b:4" }