本文整理汇总了TypeScript中@project/expression/src/exports.expression_eval函数的典型用法代码示例。如果您正苦于以下问题:TypeScript expression_eval函数的具体用法?TypeScript expression_eval怎么用?TypeScript expression_eval使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了expression_eval函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: _modelArgsBinding
function _modelArgsBinding(args: any[], expr, model, ctx, ctr) {
var arr = null;
if (expr == null) {
var i = args.length;
arr = new Array(i);
while (--i > -1) {
arr[i] = expression_eval(args[i].name, model, ctx, ctr);
}
} else {
arr = expression_evalStatements(expr, model, ctx, ctr);
}
var out = {},
arrMax = arr.length,
argsMax = args.length,
i = -1;
while (++i < arrMax && i < argsMax) {
var val = arr[i];
if (val == null) {
var type = args[i].type;
if (type != null) {
var Type = type;
if (typeof type === 'string') {
Type = expression_eval(type, model, ctx, ctr);
if (Type == null) {
error_withCompo(type + ' was not resolved', ctr);
} else {
val = Di.resolve(Type);
}
}
}
}
out[args[i].name] = val;
}
return out;
}
示例2: compo_extends
function compo_extends(extends_, model, ctr) {
var args = [];
if (extends_ == null)
return args;
var imax = extends_.length,
i = -1,
await = 0, x;
while( ++i < imax ){
x = extends_[i];
if (x.compo) {
var compo = customTag_get(x.compo, ctr);
if (compo != null) {
args.unshift(compo);
continue;
}
var obj = expression_eval(x.compo, model, null, ctr);
if (obj != null) {
args.unshift(obj);
continue;
}
log_error('Nor component, nor scoped data is resolved:', x.compo);
continue;
}
}
return args;
}
示例3: expression_createListener
return expression_createListener(function(){
let value = expression_eval(expr, model, ctx, ctr);
let args = _Array_slice.call(arguments);
args[0] = value == null ? '' : value;
fn.apply(this, args);
});
示例4: function
render: function(model, ctx, container, ctr, children){
var directive = For.parseFor(this.expression),
attr = this.attr;
attr[attr_PROP_1] = directive[0];
attr[attr_PROP_2] = directive[1];
attr[attr_TYPE] = directive[2];
attr[attr_EXPR] = directive[3];
var value = expression_eval(directive[3], model, ctx, ctr);
if (value == null)
return;
if (is_Array(value))
arr_createRefs(value);
For.build(
value,
directive,
this.nodes,
model,
ctx,
container,
this,
children
);
},
示例5: mergeArgs
function mergeArgs(argMetas, args) {
var model = args[1];
var controller = args[4];
var tLength = argMetas.length,
aLength = args.length,
max = tLength > aLength ? tLength : aLength,
arr = new Array(max),
i = -1;
while (++i < max) {
// injections are resolved first.
if (i < tLength && argMetas[i].type != null) {
var Type = expression_eval(
argMetas[i].type,
model,
null,
controller
);
arr[i] = Di.resolve(Type);
continue;
}
if (i < aLength && args[i] != null) {
arr[i] = args[i];
continue;
}
}
return arr;
}
示例6: function
'expression_eval multiple': function() {
eq_(true, expression_eval("age > 10 && info.name == 'Alex'", {
info: {
name: 'Alex'
},
age: 100
}));
},
示例7: function
render: function(node, model, ctx, container, ctr, children){
var els = [];
builder_build(node.nodes, model, ctx, container, ctr, els);
arr_pushMany(children, els)
var visible = expression_eval(node.expression, model, ctx, ctr);
toggle(els, visible);
}
示例8: function
render: function(node, model, ctx, el, ctr, elements){
var value = expression_eval(node.expression, model, ctx, ctr),
nodes = getNodes(value, node.nodes, model, ctx, ctr);
if (nodes == null)
return;
builder_build(nodes, model, ctx, el, ctr, elements);
},
示例9: function
getObject: function(model, ctx, ctr){
var obj = {},
attr = this.attr,
key;
for(key in attr) {
obj[key] = expression_eval(attr[key], model, ctx, ctr);
}
return obj;
}
示例10: expression_parse
var awaiters = arr.map(async str => {
var ast = expression_parse('"I`m " + user->name + user->name');
eq_(ast.async, true);
var user = {name: 'John'};
var result = await expression_eval(ast, { user });
deepEq_(result, 'I`m JohnJohn');
});