Skip to content

Commit

Permalink
remove trailing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
archmoj committed Jun 11, 2020
1 parent 798b0d5 commit 36587c2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var unparse = require('escodegen').generate;
module.exports = function (ast, vars) {
if (!vars) vars = {};
var FAIL = {};

var result = (function walk (node, noExecute) {
if (node.type === 'Literal') {
return node.value;
Expand Down Expand Up @@ -63,7 +63,7 @@ module.exports = function (ast, vars) {
if (l === FAIL) return FAIL;
var r = walk(node.right, noExecute);
if (r === FAIL) return FAIL;

if (op === '==') return l == r;
if (op === '===') return l === r;
if (op === '!=') return l != r;
Expand All @@ -80,7 +80,7 @@ module.exports = function (ast, vars) {
if (op === '|') return l | r;
if (op === '&') return l & r;
if (op === '^') return l ^ r;

return FAIL;
}
else if (node.type === 'Identifier') {
Expand All @@ -100,7 +100,7 @@ module.exports = function (ast, vars) {
if (callee === FAIL) return FAIL;
if (typeof callee !== 'function') return FAIL;


var ctx = node.callee.object ? walk(node.callee.object, noExecute) : FAIL;
if (ctx === FAIL) ctx = null;

Expand All @@ -119,7 +119,7 @@ module.exports = function (ast, vars) {
}
else if (node.type === 'MemberExpression') {
var obj = walk(node.object, noExecute);
// do not allow access to methods on Function
// do not allow access to methods on Function
if((obj === FAIL) || (typeof obj == 'function')){
return FAIL;
}
Expand Down Expand Up @@ -147,7 +147,7 @@ module.exports = function (ast, vars) {
}
else if (node.type === 'FunctionExpression') {
var bodies = node.body.body;

// Create a "scope" for our arguments
var oldVars = {};
Object.keys(vars).forEach(function(element){
Expand All @@ -168,7 +168,7 @@ module.exports = function (ast, vars) {
}
// restore the vars and scope after we walk
vars = oldVars;

var keys = Object.keys(vars);
var vals = keys.map(function(key) {
return vars[key];
Expand Down Expand Up @@ -196,7 +196,7 @@ module.exports = function (ast, vars) {
}
else return FAIL;
})(ast);

return result === FAIL ? undefined : result;
};

Expand Down

0 comments on commit 36587c2

Please sign in to comment.