silverwolf-x's picture
download
raw
841 Bytes
/**
* Simple object check.
* @param item
* @returns {boolean}
*/
export function isObject(item: unknown): boolean {
return Boolean(item && typeof item === "object" && !Array.isArray(item));
}
/**
* Deep merge two objects.
* @param target
* @param ...sources
*/
export default function deepMerge<T extends object, R extends object>(
target: T,
source: R,
): T {
const output = { ...target };
if (isObject(target) && isObject(source)) {
Object.keys(source).forEach((key) => {
if (isObject(source[key])) {
// @ts-ignore
if (!(key in target)) {
Object.assign(output, { [key]: source[key] });
} else {
output[key] = deepMerge(target[key], source[key]);
}
} else {
Object.assign(output, { [key]: source[key] });
}
});
}
return output;
}

Xet Storage Details

Size:
841 Bytes
·
Xet hash:
cc7969aad8c7e564859b3968a7d47a775d57eb270854db59cf8e66c3d7f2da82

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.