Skip to content

Exception when the strict and compat compiler options are used together #1741

Open
@nkochakian

Description

@nkochakian

Using compat : true and strict : true as compiler options causes an exception when executing the template

require("handlebars").compile("{{v}}", { compat : true, strict : true })({ v : "a" })

node_modules\handlebars\dist\cjs\handlebars\runtime.js:111
      if (!obj || !(name in obj)) {
                         ^

TypeError: Cannot use 'in' operator to search for 'v' in a
    at Object.strict (node_modules\handlebars\dist\cjs\handlebars\runtime.js:111:26)
    at Object.eval [as main] (eval at createFunctionContext (node_modules\handlebars\dist\cjs\handlebars\compiler\javascript-compiler.js:262:23), <anonymous>:11:87)
    at main (node_modules\handlebars\dist\cjs\handlebars\runtime.js:208:32)
    at ret (node_modules\handlebars\dist\cjs\handlebars\runtime.js:212:12)
    at ret (node_modules\handlebars\dist\cjs\handlebars\compiler\compiler.js:519:21)
    at Object.<anonymous> (index.js:9:80)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)

Tested with version 4.7.7

https://runkit.com/embed/70ypjaj1dra0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions