Skip to content

Commit 60c938c

Browse files
refactor(common): Switch inherit to use ES5 Object.create()
1 parent c9b8bb5 commit 60c938c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/common/common.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ export function createProxyFunctions(source: Function, target: Obj, bind: Functi
137137
* prototypal inheritance helper.
138138
* Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it
139139
*/
140-
export const inherit = (parent: Obj, extra: Obj) =>
141-
extend(new (extend(function() {}, { prototype: parent }))(), extra);
140+
export const inherit = (parent: Obj, extra?: Obj) =>
141+
extend(Object.create(parent), extra);
142142

143143
/**
144144
* Given an arguments object, converts the arguments at index idx and above to an array.

0 commit comments

Comments
 (0)