# extendify/1.17.1/src/Shared/lib/utils.js

Extendify, version 1.17.1. 26 lines.

- Page: https://pluginprobe.com/plugins/extendify/1.17.1/code/src/Shared/lib/utils.js
- Raw: https://pluginprobe.com/plugins/extendify/1.17.1/raw/src/Shared/lib/utils.js
- Modified: 2025-02-03T19:18:34+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/extendify/1.17.1/code/src/Shared/lib/utils.js#L10-L20`.

```javascript
export const deepMerge = (target, ...sources) => {
	return sources.reduce((acc, source) => {
		if (!isObject(acc) || !isObject(source)) {
			return null;
		}

		const newTarget = { ...acc };

		for (const key in source) {
			if (isObject(source[key]) && key in newTarget) {
				newTarget[key] = deepMerge(newTarget[key], source[key]);
			} else {
				newTarget[key] = source[key];
			}
		}

		return newTarget;
	}, target);
};

export const isObject = (value) => {
	return typeof value === 'object' && !Array.isArray(value) && value !== null;
};

export const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

```
