feature: variable lookup respects to to_liquid, #81

This commit is contained in:
harttle
2018-08-14 00:11:50 +08:00
committed by Jun Yang
parent ea38a9e1f5
commit 5b43520d78
4 changed files with 35 additions and 22 deletions
+4 -3
View File
@@ -1,3 +1,4 @@
'use strict'
const toStr = Object.prototype.toString
/*
@@ -10,12 +11,12 @@ function isString (value) {
}
function stringify (value) {
if (value && typeof value.to_liquid === 'function') {
return stringify(value.to_liquid())
}
if (isString(value)) {
return value
}
if (value && typeof value.to_liquid === 'function') {
return value.to_liquid()
}
let cache = []
return JSON.stringify(value, (key, value) => {