Skip to content

Commit 03f66a5

Browse files
committed
feat(utils): add cloneInstance function
1 parent 84ce57a commit 03f66a5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/common/utils.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Clone a new object by an object instance
3+
* @param origin Original object instance
4+
*/
5+
export function cloneInstance<T>(origin: T) {
6+
return {
7+
...origin,
8+
...Object.getPrototypeOf(origin),
9+
};
10+
}

0 commit comments

Comments
 (0)