Similar to groupArrayBy but maps array entries to a single key and requires keyandvalue 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.
Example
import {arrayToObject} from'@augment-vir/common';
constresult = arrayToObject(['a', 'b'], (value) => { return {key:`key-${value}`, value}; }); // result is `{key-a: 'a', key-b: 'b'}`
Similar to groupArrayBy but maps array entries to a single key and requires
key
andvalue
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.Example
Package
@augment-vir/common