File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 1
1
var unparse = require ( 'escodegen' ) . generate ;
2
2
3
- module . exports = function ( ast , vars ) {
3
+ module . exports = function ( ast , vars , opts ) {
4
+ if ( ! opts ) opts = { } ;
5
+ var rejectAccessToMethodsOnFunctions = ! opts . allowAccessToMethodsOnFunctions ;
6
+
4
7
if ( ! vars ) vars = { } ;
5
8
var FAIL = { } ;
6
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 ) ;
122
- // do not allow access to methods on Function
123
- if ( ( obj === FAIL ) || ( typeof obj == 'function' ) ) {
125
+ if ( ( obj === FAIL ) || (
126
+ ( typeof obj == 'function' ) && rejectAccessToMethodsOnFunctions
127
+ ) ) {
124
128
return FAIL ;
125
129
}
126
130
if ( node . property . type === 'Identifier' && ! node . computed ) {
You can’t perform that action at this time.
0 commit comments