appium-uiautomator2-driver
Version:
UiAutomator2 integration for Appium
15 lines (14 loc) • 423 B
text/typescript
/**
* Assigns own enumerable properties of `source` onto `target` only where `target[key] === undefined`
* (lodash `defaults` semantics).
*/
export function assignDefaults<T extends Record<string, unknown>>(
target: T,
source: Record<string, unknown>,
): void {
for (const key of Object.keys(source)) {
if (target[key] === undefined) {
(target as Record<string, unknown>)[key] = source[key];
}
}
}