UNPKG

539 BJavaScriptView Raw
1// Copyright 2017-2022 @polkadot/util authors & contributors
2// SPDX-License-Identifier: Apache-2.0
3import { objectKeys } from "./keys.js";
4/**
5 * @name objectSpread
6 * @summary Concats all sources into the destination
7 */
8
9export function objectSpread(dest, ...sources) {
10 for (let i = 0; i < sources.length; i++) {
11 const src = sources[i];
12
13 if (src) {
14 const keys = objectKeys(src);
15
16 for (let j = 0; j < keys.length; j++) {
17 const key = keys[j];
18 dest[key] = src[key];
19 }
20 }
21 }
22
23 return dest;
24}
\No newline at end of file