feat: support function calls, closes #222

This commit is contained in:
harttle
2021-02-12 13:47:30 +08:00
parent 81e11bb9c4
commit e37824fd8a
4 changed files with 17 additions and 4 deletions
+1 -1
View File
@@ -70,8 +70,8 @@ export class Context {
export function readProperty (obj: Scope, key: string) {
if (isNil(obj)) return obj
obj = toLiquid(obj)
if (isFunction(obj[key])) return obj[key]()
if (obj instanceof Drop) {
if (isFunction(obj[key])) return obj[key]()
if (obj.hasOwnProperty(key)) return obj[key]
return obj.liquidMethodMissing(key)
}