Files
liquidjs/src/render/boolean.ts
T

14 lines
320 B
TypeScript

import { Context } from '../context/context'
export function isTruthy (val: any, ctx: Context): boolean {
return !isFalsy(val, ctx)
}
export function isFalsy (val: any, ctx: Context): boolean {
if (ctx.opts.jsTruthy) {
return !val
} else {
return val === false || undefined === val || val === null
}
}