fix: default filter is not working with an empty string, #122

This commit is contained in:
harttle
2019-04-27 00:26:17 +08:00
parent 87489f6098
commit 6075c0a54f
2 changed files with 9 additions and 4 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
import { isTruthy } from '../../render/syntax'
import { isFalsy } from '../../render/syntax'
export default {
'default': <T1, T2>(v: T1, arg: T2): T1 | T2 => isTruthy(v) ? v : arg
'default': <T1, T2>(v: string | T1, arg: T2): string | T1 | T2 => isFalsy(v) || v === '' ? arg : v
}