We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 36587c2 commit e619afcCopy full SHA for e619afc
index.js
@@ -1,6 +1,9 @@
1
var unparse = require('escodegen').generate;
2
3
-module.exports = function (ast, vars) {
+module.exports = function (ast, vars, opts) {
4
+ if(!opts) opts = {};
5
+ var rejectAccessToMethodsOnFunctions = !opts.allowAccessToMethodsOnFunctions;
6
+
7
if (!vars) vars = {};
8
var FAIL = {};
9
@@ -119,8 +122,9 @@ module.exports = function (ast, vars) {
119
122
}
120
123
else if (node.type === 'MemberExpression') {
121
124
var obj = walk(node.object, noExecute);
- // do not allow access to methods on Function
- if((obj === FAIL) || (typeof obj == 'function')){
125
+ if((obj === FAIL) || (
126
+ (typeof obj == 'function') && rejectAccessToMethodsOnFunctions
127
+ )){
128
return FAIL;
129
130
if (node.property.type === 'Identifier' && !node.computed) {
0 commit comments