You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Handle missing params
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
@@ -703,6 +703,9 @@ export function compare(a: string, b: string): number {
|
|||||||
* @returns the target object
|
* @returns the target object
|
||||||
*/
|
*/
|
||||||
export function recursivelyAssign<T extends Object, S extends Object>(target: T, source: S, ignoreNullish = false): T {
|
export function recursivelyAssign<T extends Object, S extends Object>(target: T, source: S, ignoreNullish = false): T {
|
||||||
|
if (!target) target = Object({});
|
||||||
|
if (!source) source = Object({});
|
||||||
|
|
||||||
for (const [sourceKey, sourceValue] of Object.entries(source)) {
|
for (const [sourceKey, sourceValue] of Object.entries(source)) {
|
||||||
if (target[sourceKey] instanceof Object && sourceValue) {
|
if (target[sourceKey] instanceof Object && sourceValue) {
|
||||||
recursivelyAssign(target[sourceKey], sourceValue);
|
recursivelyAssign(target[sourceKey], sourceValue);
|
||||||
|
|||||||
Reference in New Issue
Block a user