sbis3-node-ws
Version:
Модуль позволяет использовать ядро интерфейсного фреймворка sbis3-ws(`core.js`) и модуль работы с данными (`Source.js`) в приложении на nodejs.
26 lines • 1.12 kB
JavaScript
define('js!Core/tmpl/js/helpers/processExpressions', ['js!Core/tmpl/js/helpers/expressions', 'js!Core/tmpl/js/helpers/errorHandling', 'js!Core/tmpl/js/helpers/utils'], function processExpressionsCaller(expressions, errorHandling, utils) {
'use strict';
/**
* Process expressions entry point
*/
return function processExpressionsRec(expressionRaw, data, calculators, filename) {
var i, body, res;
if (expressionRaw.type === 'var') {
if (expressionRaw.name.type === 'Program') {
body = expressionRaw.name.body;
expressions.calculators = calculators;
expressions.filename = filename;
for (i = 0; i < body.length; i++) {
if (expressions[body[i].type]) {
res = expressions[body[i].type].call(expressions, body[i], data);
expressionRaw.value = res;
return utils.escape(res);
}
}
} else {
errorHandling('Something wrong with the expression given', filename);
}
}
return expressionRaw.value;
};
});