fix: use drop valueOf when evaluated as condition (#705)

This commit is contained in:
Adam Tanner
2024-06-05 08:28:21 +08:00
committed by GitHub
parent 513940dfa7
commit a7da93ff0f
3 changed files with 27 additions and 2 deletions
+3
View File
@@ -1,10 +1,13 @@
import { Context } from '../context/context'
import { toValue } from '../util'
export function isTruthy (val: any, ctx: Context): boolean {
return !isFalsy(val, ctx)
}
export function isFalsy (val: any, ctx: Context): boolean {
val = toValue(val)
if (ctx.opts.jsTruthy) {
return !val
} else {