Support function context in expression's evaluate

This commit is contained in:
Shweelan Samson authored and Zaid Abdulla committed 2019-06-05 00:17:36 -07:00
1 parent f0b0f77433
commit 08e3933c4a
1 file changed
+4 -1
+4 -1
View File
@@ -88,7 +88,10 @@ export function evaluate(exp, obj?, now?: number, cb?: Function): Expression {
} else if (e[0] === "PARAM") {
if (e[1] == null) return null;
if (obj && !isArray(e[1])) {
let v = obj[e[1]];
let v;
if (typeof obj === "function") v = obj(e[1]);
else v = obj[e[1]];
if (v == null) return null;
if (typeof v === "object") v = v.value ? v.value[0] : null;
return v;