mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 12:20:40 -07:00
14 lines
320 B
TypeScript
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
|
|
}
|
|
}
|