Skip to content

Instantly share code, notes, and snippets.

@zsytssk
Created April 22, 2019 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zsytssk/781adb0fae5558533b2b950e7321165a to your computer and use it in GitHub Desktop.
Save zsytssk/781adb0fae5558533b2b950e7321165a to your computer and use it in GitHub Desktop.
/** 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