Fix ` g is not defined` issue
Variable `g` is not defined in the evaluation scope.
This commit is contained in:
parent
2f6dd870a6
commit
6657730950
|
@ -681,7 +681,7 @@ function createModelClassCtor(name, ModelBaseClass) {
|
|||
// from a dynamically defined function. The solution is to
|
||||
// create a dynamically defined factory function that accepts
|
||||
// closure variables as arguments.
|
||||
const factory = new Function('ModelBaseClass', `
|
||||
const factory = new Function('ModelBaseClass', 'g', `
|
||||
// every class can receive hash of data as optional param
|
||||
return function ${name}(data, options) {
|
||||
if (!(this instanceof ${name})) {
|
||||
|
@ -693,7 +693,7 @@ function createModelClassCtor(name, ModelBaseClass) {
|
|||
ModelBaseClass.apply(this, arguments);
|
||||
};`);
|
||||
|
||||
return factory(ModelBaseClass);
|
||||
return factory(ModelBaseClass, g);
|
||||
} catch (err) {
|
||||
// modelName is not a valid function/class name, e.g. 'grand-child'
|
||||
// and our simple sanitization was not good enough.
|
||||
|
|
Loading…
Reference in New Issue