UNPKG

ascii-ui

Version:

Graphic terminal emulator for HTML canvas elements

23 lines 719 B
import { isPlainObject } from 'vanilla-type-check/isPlainObject'; export function deepAssign(...args) { const target = args[0] || {}; for (let i = 1; i < args.length; i++) { const obj = args[i]; Object.keys(obj).forEach((key) => { const val = obj[key]; if (isPlainObject(val)) { if (!target[key]) { target[key] = Object.assign({}, val); } else { deepAssign(target[key], val); } } else if (target[key] !== val) { target[key] = obj[key]; } }); } return target; } //# sourceMappingURL=deepAssign.js.map