v3 new release (#84)

swap to graphql
This commit is contained in:
github-actions[bot]
2022-07-11 13:48:02 -04:00
committed by GitHub
parent 20d2b4f98d
commit e4f3964f67
1492 changed files with 63799 additions and 63001 deletions

View File

@ -8,6 +8,14 @@ exports.evaluateTruthy = evaluateTruthy;
const VALID_CALLEES = ["String", "Number", "Math"];
const INVALID_METHODS = ["random"];
function isValidCallee(val) {
return VALID_CALLEES.includes(val);
}
function isInvalidMethod(val) {
return INVALID_METHODS.includes(val);
}
function evaluateTruthy() {
const res = this.evaluate();
if (res.confident) return !!res.value;
@ -336,7 +344,7 @@ function _evaluate(path, state) {
let context;
let func;
if (callee.isIdentifier() && !path.scope.getBinding(callee.node.name) && VALID_CALLEES.indexOf(callee.node.name) >= 0) {
if (callee.isIdentifier() && !path.scope.getBinding(callee.node.name) && isValidCallee(callee.node.name)) {
func = global[callee.node.name];
}
@ -344,7 +352,7 @@ function _evaluate(path, state) {
const object = callee.get("object");
const property = callee.get("property");
if (object.isIdentifier() && property.isIdentifier() && VALID_CALLEES.indexOf(object.node.name) >= 0 && INVALID_METHODS.indexOf(property.node.name) < 0) {
if (object.isIdentifier() && property.isIdentifier() && isValidCallee(object.node.name) && !isInvalidMethod(property.node.name)) {
context = global[object.node.name];
func = context[property.node.name];
}