diff --git a/src/context/context.ts b/src/context/context.ts index 7339870bea..91eb3c9f2e 100644 --- a/src/context/context.ts +++ b/src/context/context.ts @@ -32,12 +32,14 @@ export class Context { * Throw when accessing undefined variable? */ public strictVariables: boolean; + public ownPropertyOnly: boolean; public constructor (env: object = {}, opts: NormalizedFullOptions = defaultOptions, renderOptions: RenderOptions = {}) { this.sync = !!renderOptions.sync this.opts = opts this.globals = renderOptions.globals ?? opts.globals this.environments = env this.strictVariables = renderOptions.strictVariables ?? this.opts.strictVariables + this.ownPropertyOnly = renderOptions.ownPropertyOnly ?? opts.ownPropertyOnly } public getRegister (key: string) { return (this.registers[key] = this.registers[key] || {}) @@ -74,7 +76,7 @@ export class Context { public * _getFromScope (scope: unknown, paths: PropertyKey[] | string): IterableIterator { if (isString(paths)) paths = paths.split('.') for (let i = 0; i < paths.length; i++) { - scope = yield readProperty(scope as object, paths[i], this.opts.ownPropertyOnly) + scope = yield readProperty(scope as object, paths[i], this.ownPropertyOnly) if (isNil(scope) && this.strictVariables) { throw new InternalUndefinedVariableError((paths as string[]).slice(0, i + 1).join!('.')) } diff --git a/test/integration/liquid/outputEscape.ts b/test/integration/liquid/output-escape.ts similarity index 100% rename from test/integration/liquid/outputEscape.ts rename to test/integration/liquid/output-escape.ts