feat: add option for keeping variable type in output

This commit is contained in:
Alex de Wergifosse
2020-12-16 10:20:10 +08:00
committed by Jun Yang
parent e84fbf32ad
commit cd92e77726
11 changed files with 42 additions and 21 deletions
+5 -1
View File
@@ -43,6 +43,8 @@ export interface LiquidOptions {
fs?: FS;
/** the global environment passed down to all partial templates, i.e. templates included by `include`, `layout` and `render` tags. */
globals?: object;
/** Whether or not to keep value type when writing the Output. Defaults to `false`. */
keepOutputType?: boolean;
}
interface NormalizedOptions extends LiquidOptions {
@@ -69,6 +71,7 @@ export interface NormalizedFullOptions extends NormalizedOptions {
outputDelimiterRight: string;
greedy: boolean;
globals: object;
keepOutputType: boolean;
}
export const defaultOptions: NormalizedFullOptions = {
@@ -89,7 +92,8 @@ export const defaultOptions: NormalizedFullOptions = {
strictFilters: false,
strictVariables: false,
lenientIf: false,
globals: {}
globals: {},
keepOutputType: false
}
export function normalize (options?: LiquidOptions): NormalizedOptions {