ts-expression-evaluator
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -1,10 +0,6 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const Evaluator_1 = require("./lib/Evaluator"); | ||
var functions_1 = require("./lib/functions"); | ||
exports.registerFunction = functions_1.registerFunction; | ||
exports.registerFunctions = functions_1.registerFunctions; | ||
exports.default = (code, context) => { | ||
return Evaluator_1.evaluate(code, context); | ||
import { evaluate } from './lib/Evaluator'; | ||
export { registerFunction, registerFunctions } from './lib/functions'; | ||
export default (code, context) => { | ||
return evaluate(code, context); | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwrQ0FBMkM7QUFFM0MsNkNBQXNFO0FBQTdELHVDQUFBLGdCQUFnQixDQUFBO0FBQUUsd0NBQUEsaUJBQWlCLENBQUE7QUFFNUMsa0JBQWUsQ0FBQyxJQUFZLEVBQUUsT0FBZ0IsRUFBRSxFQUFFO0lBQ2hELE9BQU8sb0JBQVEsQ0FBQyxJQUFJLEVBQUUsT0FBTyxDQUFDLENBQUM7QUFDakMsQ0FBQyxDQUFBIn0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBRTNDLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxpQkFBaUIsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBRXRFLGVBQWUsQ0FBQyxJQUFZLEVBQUUsT0FBZ0IsRUFBRSxFQUFFO0lBQ2hELE9BQU8sUUFBUSxDQUFDLElBQUksRUFBRSxPQUFPLENBQUMsQ0FBQztBQUNqQyxDQUFDLENBQUEifQ== |
@@ -1,14 +0,12 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const parser_1 = require("@babel/parser"); | ||
const Handlers_1 = require("./Handlers"); | ||
exports.evaluate = (code, context = {}) => { | ||
import { parseExpression } from '@babel/parser'; | ||
import { Handlers } from './Handlers'; | ||
export const evaluate = (code, context = {}) => { | ||
if (typeof code === 'string') { | ||
const ast = parser_1.parseExpression(code); | ||
return Handlers_1.Handlers[ast.type](ast, context); | ||
const ast = parseExpression(code); | ||
return Handlers[ast.type](ast, context); | ||
} | ||
else { | ||
return Handlers_1.Handlers[code.type](code, context); | ||
return Handlers[code.type](code, context); | ||
} | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRXZhbHVhdG9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2xpYi9FdmFsdWF0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwwQ0FBZ0Q7QUFFaEQseUNBQW9EO0FBRXZDLFFBQUEsUUFBUSxHQUFHLENBQUMsSUFBMkIsRUFBRSxVQUFjLEVBQUUsRUFBRSxFQUFFO0lBQ3hFLElBQUksT0FBTyxJQUFJLEtBQUssUUFBUSxFQUFFO1FBQzVCLE1BQU0sR0FBRyxHQUFHLHdCQUFlLENBQUMsSUFBSSxDQUFpQixDQUFDO1FBQ2xELE9BQU8sbUJBQVEsQ0FBQyxHQUFHLENBQUMsSUFBb0IsQ0FBQyxDQUFDLEdBQUcsRUFBRSxPQUFPLENBQUMsQ0FBQztLQUN6RDtTQUFNO1FBQ0wsT0FBTyxtQkFBUSxDQUFDLElBQUksQ0FBQyxJQUFvQixDQUFDLENBQUMsSUFBSSxFQUFFLE9BQU8sQ0FBQyxDQUFDO0tBQzNEO0FBQ0gsQ0FBQyxDQUFBIn0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRXZhbHVhdG9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2xpYi9FdmFsdWF0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUVoRCxPQUFPLEVBQUUsUUFBUSxFQUFnQixNQUFNLFlBQVksQ0FBQztBQUVwRCxNQUFNLENBQUMsTUFBTSxRQUFRLEdBQUcsQ0FBQyxJQUEyQixFQUFFLFVBQWMsRUFBRSxFQUFFLEVBQUU7SUFDeEUsSUFBSSxPQUFPLElBQUksS0FBSyxRQUFRLEVBQUU7UUFDNUIsTUFBTSxHQUFHLEdBQUcsZUFBZSxDQUFDLElBQUksQ0FBaUIsQ0FBQztRQUNsRCxPQUFPLFFBQVEsQ0FBQyxHQUFHLENBQUMsSUFBb0IsQ0FBQyxDQUFDLEdBQUcsRUFBRSxPQUFPLENBQUMsQ0FBQztLQUN6RDtTQUFNO1FBQ0wsT0FBTyxRQUFRLENBQUMsSUFBSSxDQUFDLElBQW9CLENBQUMsQ0FBQyxJQUFJLEVBQUUsT0FBTyxDQUFDLENBQUM7S0FDM0Q7QUFDSCxDQUFDLENBQUEifQ== |
@@ -1,12 +0,10 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const functions = {}; | ||
exports.registerFunction = (name, func) => { | ||
export const registerFunction = (name, func) => { | ||
functions[name] = func; | ||
}; | ||
exports.registerFunctions = (funcs) => { | ||
export const registerFunctions = (funcs) => { | ||
Object.keys(funcs) | ||
.forEach(key => functions[key] = funcs[key]); | ||
}; | ||
exports.getFunction = (name) => { | ||
export const getFunction = (name) => { | ||
if (functions[name]) { | ||
@@ -17,2 +15,2 @@ return functions[name]; | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnVuY3Rpb25zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2xpYi9mdW5jdGlvbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFJQSxNQUFNLFNBQVMsR0FBYyxFQUU1QixDQUFBO0FBRVksUUFBQSxnQkFBZ0IsR0FBRyxDQUFDLElBQVksRUFBRSxJQUFjLEVBQUUsRUFBRTtJQUMvRCxTQUFTLENBQUMsSUFBSSxDQUFDLEdBQUcsSUFBSSxDQUFDO0FBQ3pCLENBQUMsQ0FBQTtBQUNZLFFBQUEsaUJBQWlCLEdBQUcsQ0FBQyxLQUFrQyxFQUFFLEVBQUU7SUFDdEUsTUFBTSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUM7U0FDZixPQUFPLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLEdBQUcsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUM7QUFDakQsQ0FBQyxDQUFBO0FBRVksUUFBQSxXQUFXLEdBQUcsQ0FBQyxJQUFZLEVBQVksRUFBRTtJQUNwRCxJQUFJLFNBQVMsQ0FBQyxJQUFJLENBQUMsRUFBRTtRQUNuQixPQUFPLFNBQVMsQ0FBQyxJQUFJLENBQUMsQ0FBQztLQUN4QjtJQUNELE1BQU0sSUFBSSxLQUFLLENBQUMsWUFBWSxJQUFJLDBCQUEwQixDQUFDLENBQUE7QUFDN0QsQ0FBQyxDQUFBIn0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnVuY3Rpb25zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2xpYi9mdW5jdGlvbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSUEsTUFBTSxTQUFTLEdBQWMsRUFFNUIsQ0FBQTtBQUVELE1BQU0sQ0FBQyxNQUFNLGdCQUFnQixHQUFHLENBQUMsSUFBWSxFQUFFLElBQWMsRUFBRSxFQUFFO0lBQy9ELFNBQVMsQ0FBQyxJQUFJLENBQUMsR0FBRyxJQUFJLENBQUM7QUFDekIsQ0FBQyxDQUFBO0FBQ0QsTUFBTSxDQUFDLE1BQU0saUJBQWlCLEdBQUcsQ0FBQyxLQUFrQyxFQUFFLEVBQUU7SUFDdEUsTUFBTSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUM7U0FDZixPQUFPLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLEdBQUcsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUM7QUFDakQsQ0FBQyxDQUFBO0FBRUQsTUFBTSxDQUFDLE1BQU0sV0FBVyxHQUFHLENBQUMsSUFBWSxFQUFZLEVBQUU7SUFDcEQsSUFBSSxTQUFTLENBQUMsSUFBSSxDQUFDLEVBQUU7UUFDbkIsT0FBTyxTQUFTLENBQUMsSUFBSSxDQUFDLENBQUM7S0FDeEI7SUFDRCxNQUFNLElBQUksS0FBSyxDQUFDLFlBQVksSUFBSSwwQkFBMEIsQ0FBQyxDQUFBO0FBQzdELENBQUMsQ0FBQSJ9 |
@@ -1,14 +0,5 @@ | ||
"use strict"; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const t = __importStar(require("./t")); | ||
const Evaluator_1 = require("./Evaluator"); | ||
const functions_1 = require("./functions"); | ||
exports.Handlers = { | ||
import * as t from './t'; | ||
import { evaluate } from './Evaluator'; | ||
import { getFunction } from './functions'; | ||
export const Handlers = { | ||
BinaryExpression(ast, context) { | ||
@@ -18,17 +9,17 @@ if (t.isBinaryExpression(ast)) { | ||
case '+': | ||
return Evaluator_1.evaluate(ast.left, context) + Evaluator_1.evaluate(ast.right, context); | ||
return evaluate(ast.left, context) + evaluate(ast.right, context); | ||
case '-': | ||
return Evaluator_1.evaluate(ast.left, context) - Evaluator_1.evaluate(ast.right, context); | ||
return evaluate(ast.left, context) - evaluate(ast.right, context); | ||
case '*': | ||
return Evaluator_1.evaluate(ast.left, context) * Evaluator_1.evaluate(ast.right, context); | ||
return evaluate(ast.left, context) * evaluate(ast.right, context); | ||
case '/': | ||
return Evaluator_1.evaluate(ast.left, context) / Evaluator_1.evaluate(ast.right, context); | ||
return evaluate(ast.left, context) / evaluate(ast.right, context); | ||
case '===': | ||
return Evaluator_1.evaluate(ast.left, context) === Evaluator_1.evaluate(ast.right, context); | ||
return evaluate(ast.left, context) === evaluate(ast.right, context); | ||
case '==': | ||
return Evaluator_1.evaluate(ast.left, context) == Evaluator_1.evaluate(ast.right, context); | ||
return evaluate(ast.left, context) == evaluate(ast.right, context); | ||
case '!==': | ||
return Evaluator_1.evaluate(ast.left, context) !== Evaluator_1.evaluate(ast.right, context); | ||
return evaluate(ast.left, context) !== evaluate(ast.right, context); | ||
case '!=': | ||
return Evaluator_1.evaluate(ast.left, context) != Evaluator_1.evaluate(ast.right, context); | ||
return evaluate(ast.left, context) != evaluate(ast.right, context); | ||
} | ||
@@ -52,5 +43,5 @@ } | ||
if (t.isIdentifier(ast.callee)) { | ||
const func = functions_1.getFunction(ast.callee.name); | ||
const func = getFunction(ast.callee.name); | ||
const args = ast.arguments.map(arg => { | ||
return Evaluator_1.evaluate(arg, context); | ||
return evaluate(arg, context); | ||
}); | ||
@@ -64,7 +55,7 @@ return func.call(null, ...args); | ||
if (t.isMemberExpression(ast)) { | ||
const obj = Evaluator_1.evaluate(ast.object, context); | ||
const obj = evaluate(ast.object, context); | ||
if (!obj) | ||
return undefined; | ||
if (t.isIdentifier(ast.property)) { | ||
return Evaluator_1.evaluate(ast.property, obj); | ||
return evaluate(ast.property, obj); | ||
} | ||
@@ -74,3 +65,3 @@ if (t.isNumericLiteral(ast.property) || t.isStringLiteral(ast.property)) { | ||
} | ||
return Evaluator_1.evaluate(ast.property, context); | ||
return evaluate(ast.property, context); | ||
} | ||
@@ -108,3 +99,3 @@ throw new Error(); | ||
throw new Error(); | ||
return Evaluator_1.evaluate(elem, context); | ||
return evaluate(elem, context); | ||
}); | ||
@@ -115,2 +106,2 @@ } | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSGFuZGxlcnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvbGliL0hhbmRsZXJzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7OztBQUFBLHVDQUF5QjtBQUN6QiwyQ0FBdUM7QUFDdkMsMkNBQTBDO0FBYzdCLFFBQUEsUUFBUSxHQUFhO0lBQ2hDLGdCQUFnQixDQUFDLEdBQWlCLEVBQUUsT0FBZ0I7UUFDbEQsSUFBSSxDQUFDLENBQUMsa0JBQWtCLENBQUMsR0FBRyxDQUFDLEVBQUU7WUFDN0IsUUFBUSxHQUFHLENBQUMsUUFBUSxFQUFFO2dCQUNwQixLQUFLLEdBQUc7b0JBQ04sT0FBTyxvQkFBUSxDQUFDLEdBQUcsQ0FBQyxJQUFJLEVBQUUsT0FBTyxDQUFDLEdBQUcsb0JBQVEsQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLE9BQU8sQ0FBQyxDQUFDO2dCQUNwRSxLQUFLLEdBQUc7b0JBQ04sT0FBTyxvQkFBUSxDQUFDLEdBQUcsQ0FBQyxJQUFJLEVBQUUsT0FBTyxDQUFDLEdBQUcsb0JBQVEsQ0FB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LQUFLLEVBQUUsQ0FBQztJQUNwQixDQUFDO0lBQ0QsZUFBZSxDQUFDLEdBQWlCLEVBQUUsT0FBZ0I7UUFDakQsSUFBSSxDQUFDLENBQUMsaUJBQWlCLENBQUMsR0FBRyxDQUFDLEVBQUU7WUFDNUIsT0FBTyxHQUFHLENBQUMsUUFBUSxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsRUFBRTtnQkFDN0IsSUFBSSxDQUFDLElBQUk7b0JBQUUsTUFBTSxJQUFJLEtBQUssRUFBRSxDQUFDO2dCQUM3QixPQUFPLFFBQVEsQ0FBQyxJQUFvQixFQUFFLE9BQU8sQ0FBQyxDQUFDO1lBQ2pELENBQUMsQ0FBQyxDQUFDO1NBQ0o7UUFDRCxNQUFNLElBQUksS0FBSyxFQUFFLENBQUM7SUFDcEIsQ0FBQztDQUNGLENBQUEifQ== |
@@ -1,30 +0,28 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isIdentifier = (ast) => { | ||
export const isIdentifier = (ast) => { | ||
return ast.type === 'Identifier'; | ||
}; | ||
exports.isBinaryExpression = (ast) => { | ||
export const isBinaryExpression = (ast) => { | ||
return ast.type === 'BinaryExpression'; | ||
}; | ||
exports.isMemberExpression = (ast) => { | ||
export const isMemberExpression = (ast) => { | ||
return ast.type === 'MemberExpression'; | ||
}; | ||
exports.isNumericLiteral = (ast) => { | ||
export const isNumericLiteral = (ast) => { | ||
return ast.type === 'NumericLiteral'; | ||
}; | ||
exports.isStringLiteral = (ast) => { | ||
export const isStringLiteral = (ast) => { | ||
return ast.type === 'StringLiteral'; | ||
}; | ||
exports.isBooleanLiteral = (ast) => { | ||
export const isBooleanLiteral = (ast) => { | ||
return ast.type === 'BooleanLiteral'; | ||
}; | ||
exports.isNullLiteral = (ast) => { | ||
export const isNullLiteral = (ast) => { | ||
return ast.type === 'NullLiteral'; | ||
}; | ||
exports.isArrayExpression = (ast) => { | ||
export const isArrayExpression = (ast) => { | ||
return ast.type === 'ArrayExpression'; | ||
}; | ||
exports.isCallExpression = (ast) => { | ||
export const isCallExpression = (ast) => { | ||
return ast.type === 'CallExpression'; | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9saWIvdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVhLFFBQUEsWUFBWSxHQUFHLENBQUMsR0FBaUIsRUFBdUIsRUFBRTtJQUNyRSxPQUFPLEdBQUcsQ0FBQyxJQUFJLEtBQUssWUFBWSxDQUFDO0FBQ25DLENBQUMsQ0FBQTtBQUVZLFFBQUEsa0JBQWtCLEdBQUcsQ0FBQyxHQUFpQixFQUE2QixFQUFFO0lBQ2pGLE9BQU8sR0FBRyxDQUFDLElBQUksS0FBSyxrQkFBa0IsQ0FBQztBQUN6QyxDQUFDLENBQUE7QUFFWSxRQUFBLGtCQUFrQixHQUFHLENBQUMsR0FBaUIsRUFBNkIsRUFBRTtJQUNqRixPQUFPLEdBQUcsQ0FBQyxJQUFJLEtBQUssa0JBQWtCLENBQUM7QUFDekMsQ0FBQyxDQUFBO0FBRVksUUFBQSxnQkFBZ0IsR0FBRyxDQUFDLEdBQWlCLEVBQTJCLEVBQUU7SUFDN0UsT0FBTyxHQUFHLENBQUMsSUFBSSxLQUFLLGdCQUFnQixDQUFDO0FBQ3ZDLENBQUMsQ0FBQTtBQUNZLFFBQUEsZUFBZSxHQUFHLENBQUMsR0FBaUIsRUFBMEIsRUFBRTtJQUMzRSxPQUFPLEdBQUcsQ0FBQyxJQUFJLEtBQUssZUFBZSxDQUFDO0FBQ3RDLENBQUMsQ0FBQTtBQUNZLFFBQUEsZ0JBQWdCLEdBQUcsQ0FBQyxHQUFpQixFQUEyQixFQUFFO0lBQzdFLE9BQU8sR0FBRyxDQUFDLElBQUksS0FBSyxnQkFBZ0IsQ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BQTtBQUVELE1BQU0sQ0FBQyxNQUFNLGdCQUFnQixHQUFHLENBQUMsR0FBaUIsRUFBMkIsRUFBRTtJQUM3RSxPQUFPLEdBQUcsQ0FBQyxJQUFJLEtBQUssZ0JBQWdCLENBQUM7QUFDdkMsQ0FBQyxDQUFBO0FBQ0QsTUFBTSxDQUFDLE1BQU0sZUFBZSxHQUFHLENBQUMsR0FBaUIsRUFBMEIsRUFBRTtJQUMzRSxPQUFPLEdBQUcsQ0FBQyxJQUFJLEtBQUssZUFBZSxDQUFDO0FBQ3RDLENBQUMsQ0FBQTtBQUNELE1BQU0sQ0FBQyxNQUFNLGdCQUFnQixHQUFHLENBQUMsR0FBaUIsRUFBMkIsRUFBRTtJQUM3RSxPQUFPLEdBQUcsQ0FBQyxJQUFJLEtBQUssZ0JBQWdCLENBQUM7QUFDdkMsQ0FBQyxDQUFBO0FBQ0QsTUFBTSxDQUFDLE1BQU0sYUFBYSxHQUFHLENBQUMsR0FBaUIsRUFBd0IsRUFBRTtJQUN2RSxPQUFPLEdBQUcsQ0FBQyxJQUFJLEtBQUssYUFBYSxDQUFDO0FBQ3BDLENBQUMsQ0FBQTtBQUNELE1BQU0sQ0FBQyxNQUFNLGlCQUFpQixHQUFHLENBQUMsR0FBaUIsRUFBNEIsRUFBRTtJQUMvRSxPQUFPLEdBQUcsQ0FBQyxJQUFJLEtBQUssaUJBQWlCLENBQUM7QUFDeEMsQ0FBQyxDQUFBO0FBQ0QsTUFBTSxDQUFDLE1BQU0sZ0JBQWdCLEdBQUcsQ0FBQyxHQUFpQixFQUEyQixFQUFFO0lBQzdFLE9BQU8sR0FBRyxDQUFDLElBQUksS0FBSyxnQkFBZ0IsQ0FBQztBQUN2QyxDQUFDLENBQUEifQ== |
@@ -1,10 +0,6 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const Evaluator_1 = require("./lib/Evaluator"); | ||
var functions_1 = require("./lib/functions"); | ||
exports.registerFunction = functions_1.registerFunction; | ||
exports.registerFunctions = functions_1.registerFunctions; | ||
exports.default = (code, context) => { | ||
return Evaluator_1.evaluate(code, context); | ||
import { evaluate } from './lib/Evaluator'; | ||
export { registerFunction, registerFunctions } from './lib/functions'; | ||
export default (code, context) => { | ||
return evaluate(code, context); | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwrQ0FBMkM7QUFFM0MsNkNBQXNFO0FBQTdELHVDQUFBLGdCQUFnQixDQUFBO0FBQUUsd0NBQUEsaUJBQWlCLENBQUE7QUFFNUMsa0JBQWUsQ0FBQyxJQUFZLEVBQUUsT0FBZ0IsRUFBRSxFQUFFO0lBQ2hELE9BQU8sb0JBQVEsQ0FBQyxJQUFJLEVBQUUsT0FBTyxDQUFDLENBQUM7QUFDakMsQ0FBQyxDQUFBIn0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBRTNDLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxpQkFBaUIsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBRXRFLGVBQWUsQ0FBQyxJQUFZLEVBQUUsT0FBZ0IsRUFBRSxFQUFFO0lBQ2hELE9BQU8sUUFBUSxDQUFDLElBQUksRUFBRSxPQUFPLENBQUMsQ0FBQztBQUNqQyxDQUFDLENBQUEifQ== |
@@ -1,14 +0,12 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const parser_1 = require("@babel/parser"); | ||
const Handlers_1 = require("./Handlers"); | ||
exports.evaluate = (code, context = {}) => { | ||
import { parseExpression } from '@babel/parser'; | ||
import { Handlers } from './Handlers'; | ||
export const evaluate = (code, context = {}) => { | ||
if (typeof code === 'string') { | ||
const ast = parser_1.parseExpression(code); | ||
return Handlers_1.Handlers[ast.type](ast, context); | ||
const ast = parseExpression(code); | ||
return Handlers[ast.type](ast, context); | ||
} | ||
else { | ||
return Handlers_1.Handlers[code.type](code, context); | ||
return Handlers[code.type](code, context); | ||
} | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRXZhbHVhdG9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2xpYi9FdmFsdWF0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwwQ0FBZ0Q7QUFFaEQseUNBQW9EO0FBRXZDLFFBQUEsUUFBUSxHQUFHLENBQUMsSUFBMkIsRUFBRSxVQUFjLEVBQUUsRUFBRSxFQUFFO0lBQ3hFLElBQUksT0FBTyxJQUFJLEtBQUssUUFBUSxFQUFFO1FBQzVCLE1BQU0sR0FBRyxHQUFHLHdCQUFlLENBQUMsSUFBSSxDQUFpQixDQUFDO1FBQ2xELE9BQU8sbUJBQVEsQ0FBQyxHQUFHLENBQUMsSUFBb0IsQ0FBQyxDQUFDLEdBQUcsRUFBRSxPQUFPLENBQUMsQ0FBQztLQUN6RDtTQUFNO1FBQ0wsT0FBTyxtQkFBUSxDQUFDLElBQUksQ0FBQyxJQUFvQixDQUFDLENBQUMsSUFBSSxFQUFFLE9BQU8sQ0FBQyxDQUFDO0tBQzNEO0FBQ0gsQ0FBQyxDQUFBIn0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRXZhbHVhdG9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2xpYi9FdmFsdWF0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUVoRCxPQUFPLEVBQUUsUUFBUSxFQUFnQixNQUFNLFlBQVksQ0FBQztBQUVwRCxNQUFNLENBQUMsTUFBTSxRQUFRLEdBQUcsQ0FBQyxJQUEyQixFQUFFLFVBQWMsRUFBRSxFQUFFLEVBQUU7SUFDeEUsSUFBSSxPQUFPLElBQUksS0FBSyxRQUFRLEVBQUU7UUFDNUIsTUFBTSxHQUFHLEdBQUcsZUFBZSxDQUFDLElBQUksQ0FBaUIsQ0FBQztRQUNsRCxPQUFPLFFBQVEsQ0FBQyxHQUFHLENBQUMsSUFBb0IsQ0FBQyxDQUFDLEdBQUcsRUFBRSxPQUFPLENBQUMsQ0FBQztLQUN6RDtTQUFNO1FBQ0wsT0FBTyxRQUFRLENBQUMsSUFBSSxDQUFDLElBQW9CLENBQUMsQ0FBQyxJQUFJLEVBQUUsT0FBTyxDQUFDLENBQUM7S0FDM0Q7QUFDSCxDQUFDLENBQUEifQ== |
@@ -1,12 +0,10 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const functions = {}; | ||
exports.registerFunction = (name, func) => { | ||
export const registerFunction = (name, func) => { | ||
functions[name] = func; | ||
}; | ||
exports.registerFunctions = (funcs) => { | ||
export const registerFunctions = (funcs) => { | ||
Object.keys(funcs) | ||
.forEach(key => functions[key] = funcs[key]); | ||
}; | ||
exports.getFunction = (name) => { | ||
export const getFunction = (name) => { | ||
if (functions[name]) { | ||
@@ -17,2 +15,2 @@ return functions[name]; | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnVuY3Rpb25zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc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xFQUFFO0lBQy9ELFNBQVMsQ0FBQyxJQUFJLENBQUMsR0FBRyxJQUFJLENBQUM7QUFDekIsQ0FBQyxDQUFBO0FBQ0QsTUFBTSxDQUFDLE1BQU0saUJBQWlCLEdBQUcsQ0FBQyxLQUFrQyxFQUFFLEVBQUU7SUFDdEUsTUFBTSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUM7U0FDZixPQUFPLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLEdBQUcsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUM7QUFDakQsQ0FBQyxDQUFBO0FBRUQsTUFBTSxDQUFDLE1BQU0sV0FBVyxHQUFHLENBQUMsSUFBWSxFQUFZLEVBQUU7SUFDcEQsSUFBSSxTQUFTLENBQUMsSUFBSSxDQUFDLEVBQUU7UUFDbkIsT0FBTyxTQUFTLENBQUMsSUFBSSxDQUFDLENBQUM7S0FDeEI7SUFDRCxNQUFNLElBQUksS0FBSyxDQUFDLFlBQVksSUFBSSwwQkFBMEIsQ0FBQyxDQUFBO0FBQzdELENBQUMsQ0FBQSJ9 |
@@ -1,14 +0,5 @@ | ||
"use strict"; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const t = __importStar(require("./t")); | ||
const Evaluator_1 = require("./Evaluator"); | ||
const functions_1 = require("./functions"); | ||
exports.Handlers = { | ||
import * as t from './t'; | ||
import { evaluate } from './Evaluator'; | ||
import { getFunction } from './functions'; | ||
export const Handlers = { | ||
BinaryExpression(ast, context) { | ||
@@ -18,17 +9,17 @@ if (t.isBinaryExpression(ast)) { | ||
case '+': | ||
return Evaluator_1.evaluate(ast.left, context) + Evaluator_1.evaluate(ast.right, context); | ||
return evaluate(ast.left, context) + evaluate(ast.right, context); | ||
case '-': | ||
return Evaluator_1.evaluate(ast.left, context) - Evaluator_1.evaluate(ast.right, context); | ||
return evaluate(ast.left, context) - evaluate(ast.right, context); | ||
case '*': | ||
return Evaluator_1.evaluate(ast.left, context) * Evaluator_1.evaluate(ast.right, context); | ||
return evaluate(ast.left, context) * evaluate(ast.right, context); | ||
case '/': | ||
return Evaluator_1.evaluate(ast.left, context) / Evaluator_1.evaluate(ast.right, context); | ||
return evaluate(ast.left, context) / evaluate(ast.right, context); | ||
case '===': | ||
return Evaluator_1.evaluate(ast.left, context) === Evaluator_1.evaluate(ast.right, context); | ||
return evaluate(ast.left, context) === evaluate(ast.right, context); | ||
case '==': | ||
return Evaluator_1.evaluate(ast.left, context) == Evaluator_1.evaluate(ast.right, context); | ||
return evaluate(ast.left, context) == evaluate(ast.right, context); | ||
case '!==': | ||
return Evaluator_1.evaluate(ast.left, context) !== Evaluator_1.evaluate(ast.right, context); | ||
return evaluate(ast.left, context) !== evaluate(ast.right, context); | ||
case '!=': | ||
return Evaluator_1.evaluate(ast.left, context) != Evaluator_1.evaluate(ast.right, context); | ||
return evaluate(ast.left, context) != evaluate(ast.right, context); | ||
} | ||
@@ -52,5 +43,5 @@ } | ||
if (t.isIdentifier(ast.callee)) { | ||
const func = functions_1.getFunction(ast.callee.name); | ||
const func = getFunction(ast.callee.name); | ||
const args = ast.arguments.map(arg => { | ||
return Evaluator_1.evaluate(arg, context); | ||
return evaluate(arg, context); | ||
}); | ||
@@ -64,7 +55,7 @@ return func.call(null, ...args); | ||
if (t.isMemberExpression(ast)) { | ||
const obj = Evaluator_1.evaluate(ast.object, context); | ||
const obj = evaluate(ast.object, context); | ||
if (!obj) | ||
return undefined; | ||
if (t.isIdentifier(ast.property)) { | ||
return Evaluator_1.evaluate(ast.property, obj); | ||
return evaluate(ast.property, obj); | ||
} | ||
@@ -74,3 +65,3 @@ if (t.isNumericLiteral(ast.property) || t.isStringLiteral(ast.property)) { | ||
} | ||
return Evaluator_1.evaluate(ast.property, context); | ||
return evaluate(ast.property, context); | ||
} | ||
@@ -108,3 +99,3 @@ throw new Error(); | ||
throw new Error(); | ||
return Evaluator_1.evaluate(elem, context); | ||
return evaluate(elem, context); | ||
}); | ||
@@ -115,2 +106,2 @@ } | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSGFuZGxlcnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvbGliL0hhbmRsZXJzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7OztBQUFBLHVDQUF5QjtBQUN6QiwyQ0FBdUM7QUFDdkMsMkNBQTBDO0FBYzdCLFFBQUEsUUFBUSxHQUFhO0lBQ2hDLGdCQUFnQixDQUFDLEdBQWlCLEVBQUUsT0FBZ0I7UUFDbEQsSUFBSSxDQUFDLENBQUMsa0JBQWtCLENBQUMsR0FBRyxDQUFDLEVBQUU7WUFDN0IsUUFBUSxHQUFHLENBQUMsUUFBUSxFQUFFO2dCQUNwQixLQUFLLEdBQUc7b0JBQ04sT0FBTyxvQkFBUSxDQUFDLEdBQUcsQ0FBQyxJQUFJLEVBQUUsT0FBTyxDQUFDLEdBQUcsb0JBQVEsQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLE9BQU8sQ0FBQyxDQUFDO2dCQUNwRSxLQUFLLEdBQUc7b0JBQ04sT0FBTyxvQkFBUSxDQUFDLEdBQUcsQ0FBQyxJQUFJLEVBQUUsT0FBTyxDQUFDLEdBQUcsb0JBQVEsQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLE9BQU8sQ0FBQyxDQUFDO2dCQUNwRSxLQUFLLEdBQUc7b0JBQ04sT0FBTyxvQkFBUSxDQUFDLEdBQUcsQ0FBQyxJQUFJLEVBQUUsT0FBTyxDQUFDLEdBQUcsb0JBQVEsQ0FBQ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UMsUUFBUSxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsRUFBRTtnQkFDN0IsSUFBSSxDQUFDLElBQUk7b0JBQUUsTUFBTSxJQUFJLEtBQUssRUFBRSxDQUFDO2dCQUM3QixPQUFPLFFBQVEsQ0FBQyxJQUFvQixFQUFFLE9BQU8sQ0FBQyxDQUFDO1lBQ2pELENBQUMsQ0FBQyxDQUFDO1NBQ0o7UUFDRCxNQUFNLElBQUksS0FBSyxFQUFFLENBQUM7SUFDcEIsQ0FBQztDQUNGLENBQUEifQ== |
@@ -1,30 +0,28 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isIdentifier = (ast) => { | ||
export const isIdentifier = (ast) => { | ||
return ast.type === 'Identifier'; | ||
}; | ||
exports.isBinaryExpression = (ast) => { | ||
export const isBinaryExpression = (ast) => { | ||
return ast.type === 'BinaryExpression'; | ||
}; | ||
exports.isMemberExpression = (ast) => { | ||
export const isMemberExpression = (ast) => { | ||
return ast.type === 'MemberExpression'; | ||
}; | ||
exports.isNumericLiteral = (ast) => { | ||
export const isNumericLiteral = (ast) => { | ||
return ast.type === 'NumericLiteral'; | ||
}; | ||
exports.isStringLiteral = (ast) => { | ||
export const isStringLiteral = (ast) => { | ||
return ast.type === 'StringLiteral'; | ||
}; | ||
exports.isBooleanLiteral = (ast) => { | ||
export const isBooleanLiteral = (ast) => { | ||
return ast.type === 'BooleanLiteral'; | ||
}; | ||
exports.isNullLiteral = (ast) => { | ||
export const isNullLiteral = (ast) => { | ||
return ast.type === 'NullLiteral'; | ||
}; | ||
exports.isArrayExpression = (ast) => { | ||
export const isArrayExpression = (ast) => { | ||
return ast.type === 'ArrayExpression'; | ||
}; | ||
exports.isCallExpression = (ast) => { | ||
export const isCallExpression = (ast) => { | ||
return ast.type === 'CallExpression'; | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidC5qcyIsInNvdXJjZVJvb3Q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FBTSxDQUFDLE1BQU0sZUFBZSxHQUFHLENBQUMsR0FBaUIsRUFBMEIsRUFBRTtJQUMzRSxPQUFPLEdBQUcsQ0FBQyxJQUFJLEtBQUssZUFBZSxDQUFDO0FBQ3RDLENBQUMsQ0FBQTtBQUNELE1BQU0sQ0FBQyxNQUFNLGdCQUFnQixHQUFHLENBQUMsR0FBaUIsRUFBMkIsRUFBRTtJQUM3RSxPQUFPLEdBQUcsQ0FBQyxJQUFJLEtBQUssZ0JBQWdCLENBQUM7QUFDdkMsQ0FBQyxDQUFBO0FBQ0QsTUFBTSxDQUFDLE1BQU0sYUFBYSxHQUFHLENBQUMsR0FBaUIsRUFBd0IsRUFBRTtJQUN2RSxPQUFPLEdBQUcsQ0FBQyxJQUFJLEtBQUssYUFBYSxDQUFDO0FBQ3BDLENBQUMsQ0FBQTtBQUNELE1BQU0sQ0FBQyxNQUFNLGlCQUFpQixHQUFHLENBQUMsR0FBaUIsRUFBNEIsRUFBRTtJQUMvRSxPQUFPLEdBQUcsQ0FBQyxJQUFJLEtBQUssaUJBQWlCLENBQUM7QUFDeEMsQ0FBQyxDQUFBO0FBQ0QsTUFBTSxDQUFDLE1BQU0sZ0JBQWdCLEdBQUcsQ0FBQyxHQUFpQixFQUEyQixFQUFFO0lBQzdFLE9BQU8sR0FBRyxDQUFDLElBQUksS0FBSyxnQkFBZ0IsQ0FBQztBQUN2QyxDQUFDLENBQUEifQ== |
{ | ||
"name": "ts-expression-evaluator", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "Context-based expression parse and evaluator.", | ||
@@ -58,6 +58,6 @@ "main": "build/main/index.js", | ||
"dependencies": { | ||
"@babel/parser": "7.0.0-beta.48" | ||
"@babel/parser": "^7.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/babel__parser": "7.0.0-beta.48", | ||
"@types/babel__parser": "^7.0.0", | ||
"ava": "1.0.0-beta.7", | ||
@@ -64,0 +64,0 @@ "codecov": "^3.0.2", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
219111
390
+ Added@babel/helper-string-parser@7.25.9(transitive)
+ Added@babel/helper-validator-identifier@7.25.9(transitive)
+ Added@babel/parser@7.26.2(transitive)
+ Added@babel/types@7.26.0(transitive)
- Removed@babel/parser@7.0.0-beta.48(transitive)
Updated@babel/parser@^7.0.0