Closed joonas-lahtinen closed 9 years ago
When used together with Express.js and when passing res.locals as the template context which uses handlebars-layouts, the following error happens:
TypeError: arg.hasOwnProperty is not a function at mixin ([snip]/node_modules/handlebars-layouts/index.js:72:12)
As can be seen from the code, hasOwnProperty is expected to be a function in the objects:
if (arg.hasOwnProperty(key)) { target[key] = arg[key]; }
But this is not the case with Express.js:
// express/lib/middleware/init.js res.locals = res.locals || Object.create(null);
Where the prototype of the res.locals is not Object.
What is the value of arg at that point?
arg
Value is res.locals from Express.js, I sent a PR for the change required and added tests for it.
When used together with Express.js and when passing res.locals as the template context which uses handlebars-layouts, the following error happens:
As can be seen from the code, hasOwnProperty is expected to be a function in the objects:
But this is not the case with Express.js:
Where the prototype of the res.locals is not Object.