Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 10x 26x 11x 11x 11x 11x 24x 24x | /** * Initializes a DTO class properties. * @param self initial class instance * @param input class instance property values */ export const initializeClassProperties = <T = Record<string, unknown>>(self: T, input?: T) => { if (typeof input !== 'undefined') { const typedSelf = self as Record<string, unknown>; const typedInput = input as Record<string, unknown>; const keys = Object.keys(typedInput); for (const key of keys) { const inputValue = typedInput[key]; typedSelf[key] = typeof inputValue !== 'undefined' && inputValue !== null ? typedInput[key] : typedSelf[key]; } } }; |