mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
fix: use drop valueOf when evaluated as condition (#705)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user