UNPKG

liquidjs

Version:

A simple, expressive, extensible Liquid template engine for JavaScript — Shopify, Jekyll and GitHub Pages compatible, for Node.js, browsers, and the CLI, with TypeScript support.

16 lines (15 loc) • 984 B
import { Context } from '../context'; /** * A handler may return a `boolean` (legacy interface), a `Promise`, or a generator * that `yield`s to await async values. The render driver resolves all three, so * operators written against the legacy `=> boolean` signature keep working. */ export type OperatorGenerator = Generator<unknown, boolean, any>; export type OperatorResult = boolean | Promise<boolean> | OperatorGenerator; export type UnaryOperatorHandler = (operand: any, ctx: Context) => OperatorResult; export type BinaryOperatorHandler = (lhs: any, rhs: any, ctx: Context) => OperatorResult; export type OperatorHandler = UnaryOperatorHandler | BinaryOperatorHandler; export type Operators = Record<string, OperatorHandler>; export declare const defaultOperators: Operators; export declare function equals(lhs: any, rhs: any): Generator<unknown, boolean, any>; export declare function arrayIncludes(arr: any[], item: any): Generator<unknown, boolean, any>;