liquidjs
Version:
A simple, expressive and safe Shopify / Github Pages compatible template engine in pure JavaScript.
43 lines (42 loc) • 1.42 kB
TypeScript
import { NormalizedFullOptions, RenderOptions } from '../liquid-options';
import { Scope } from './scope';
export declare class Context {
/**
* insert a Context-level empty scope,
* for tags like {% capture %} {% assign %} to operate
*/
private scopes;
private registers;
/**
* user passed in scope
* {% increment %}, {% decrement %} changes this scope,
* whereas {% capture %}, {% assign %} only hide this scope
*/
environments: Scope;
/**
* global scope used as fallback for missing variables
*/
globals: Scope;
sync: boolean;
/**
* The normalized liquid options object
*/
opts: NormalizedFullOptions;
/**
* Throw when accessing undefined variable?
*/
strictVariables: boolean;
constructor(env?: object, opts?: NormalizedFullOptions, renderOptions?: RenderOptions);
getRegister(key: string): any;
setRegister(key: string, value: any): any;
saveRegister(...keys: string[]): [string, any][];
restoreRegister(keyValues: [string, any][]): void;
getAll(): Scope;
get(paths: string[]): object;
getFromScope(scope: object, paths: string[] | string): object;
push(ctx: object): number;
pop(): Scope | undefined;
bottom(): Scope;
private findScope;
}
export declare function readProperty(obj: Scope, key: string): any;