syphonx-core
Version:
SyphonX is a template-driven solution for extracting data from HTML in a highly efficient way. It combines the power of jQuery, Regular Expressions, and Javascript into a declarative template-driven format that extracts and reshapes HTML data into JSON.
22 lines • 961 B
JavaScript
;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.evaluateFormula = void 0;
function evaluateFormula(formula, scope) {
if (scope === void 0) { scope = {}; }
var keys = Object.keys(scope);
var values = keys.map(function (key) { return scope[key]; });
var fn = new (Function.bind.apply(Function, __spreadArray(__spreadArray([void 0], keys, false), ["return ".concat(formula)], false)))();
var result = fn.apply(void 0, values);
return result;
}
exports.evaluateFormula = evaluateFormula;
//# sourceMappingURL=formula.js.map