feat: support json filter, closes #192

This commit is contained in:
harttle
2020-03-04 03:42:18 +08:00
parent 152778b6e3
commit aa27a6cd7b
2 changed files with 9 additions and 0 deletions
+3
View File
@@ -4,5 +4,8 @@ import { toValue } from '../../util/underscore'
export default {
'default': function<T1, T2> (v: string | T1, arg: T2): string | T1 | T2 {
return isFalsy(toValue(v)) || v === '' ? arg : v
},
'json': function (v: any) {
return JSON.stringify(v)
}
}