(target: T, source: S)
| 25 | |
| 26 | // Like Object.assign but ignore null or undefined properties. |
| 27 | export function nonNullAssign<T extends object, S extends object>(target: T, source: S): T { |
| 28 | for (const key in source) { |
| 29 | if (Object.prototype.hasOwnProperty.call(source, key) && source[key] != null) |
| 30 | target[key as unknown as keyof T] = source[key] as unknown as T[keyof T]; |
| 31 | } |
| 32 | return target; |
| 33 | } |
| 34 | |
| 35 | // Return true if |obj| is not an object or it has no properties. |
| 36 | export function isEmptyObject(obj: object) { |