@augment-vir/common
Version:
A collection of augments, helpers types, functions, and classes for any JavaScript environment.
30 lines (29 loc) • 705 B
TypeScript
/**
* Merges all arrays by their property in the given objects.
*
* @category Object : Merge
* @category Package : @augment-vir/common
* @example
*
* ```ts
* import {mergePropertyArrays} from '@augment-vir/common';
*
* mergePropertyArrays(
* {
* a: [
* 'a',
* 'b',
* ],
* },
* {
* a: [
* 'c',
* 'd',
* ],
* },
* ); // output is `{a: ['a', 'b', 'c', 'd']}`
* ```
*
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
*/
export declare function mergePropertyArrays<T extends Record<PropertyKey, unknown[]>>(...inputs: ReadonlyArray<Readonly<T>>): T;