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.
21 lines (20 loc) • 960 B
TypeScript
import { QuotedToken, Token } from '../tokens';
import type { Context } from '../context';
export declare class Expression {
readonly postfix: Token[];
constructor(tokens: Iterable<Token>);
evaluate(ctx: Context, lenient?: boolean): Generator<unknown, unknown, unknown>;
valid(): boolean;
}
/**
* Evaluate `token`, preserving Drops.
* Operators use this so `Comparable` drops (`empty`, `nil`, `blank`) and custom drops
* are compared as drops rather than as their `valueOf()` result.
*/
export declare function evalToken(token: Token | undefined, ctx: Context, lenient?: boolean): IterableIterator<unknown>;
/**
* Evaluate `token` to the value filters and tags consume.
* Awaits a promise returned by `Drop.valueOf()`.
*/
export declare function evalTokenValue(token: Token | undefined, ctx: Context, lenient?: boolean): IterableIterator<unknown>;
export declare function evalQuotedToken(token: QuotedToken): string;