Created
April 22, 2019 07:49
-
-
Save zsytssk/781adb0fae5558533b2b950e7321165a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** set object properties */ | |
export function setProps<T>(data: T, props: Partial<T>) { | |
for (let key in props) { | |
if (!props.hasOwnProperty(key)) { | |
continue; | |
} | |
data[key] = props[key]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment