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 11var unparse = require ( 'escodegen' ) . generate ;
22
3- module . exports = function ( ast , vars ) {
3+ module . exports = function ( ast , vars , opts ) {
4+ if ( ! opts ) opts = { } ;
5+ var rejectAccessToMethodsOnFunctions = ! opts . allowAccessToMethodsOnFunctions ;
6+
47 if ( ! vars ) vars = { } ;
58 var FAIL = { } ;
69
@@ -119,8 +122,9 @@ module.exports = function (ast, vars) {
119122 }
120123 else if ( node . type === 'MemberExpression' ) {
121124 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+ ) ) {
124128 return FAIL ;
125129 }
126130 if ( node . property . type === 'Identifier' && ! node . computed ) {
You can’t perform that action at this time.
0 commit comments