augment-vir - v31.13.0
    Preparing search index...

    Function arrayToObject

    Similar to groupArrayBy but maps array entries to a single key and requires key and value outputs from the callback. The resulting object does not have an array of elements (unless the original array itself contains arrays). Automatically handles the case where the callback returns a promise.

    import {arrayToObject} from '@augment-vir/common';

    const result = arrayToObject(
    [
    'a',
    'b',
    ],
    (value) => {
    return {key: `key-${value}`, value};
    },
    );
    // result is `{key-a: 'a', key-b: 'b'}`