You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In lib/consolidate.js, there are many render functions use locals as options to build a template, then again, transfer the locals to the template for constructing the final page. So, users may ignore the potential issue that their locals could be used as options for the engine. And, this shortcut is not recommend by ejs.
However, be aware that your code could break if we add an option with the same name as one of your data object's properties. Therefore, we do not recommend using this shortcut. -- from https://www.npmjs.com/package/ejs
I think changing the interface from
(path[, locals], callback)
to
(path[, locals, options], callback)
will be a good solution.
The text was updated successfully, but these errors were encountered:
This has come up before and I think it's a good idea too. I'd like to do some refactoring of the code and I'll keep this in mind when doing that. One thing that needs to be thought about is how it impacts other libraries, like express, that expect template engines to have the current api. This probably just requires the correct version bump, then other libraries can choose to update to use the new api or work around it.
In lib/consolidate.js, there are many render functions use locals as options to build a template, then again, transfer the locals to the template for constructing the final page. So, users may ignore the potential issue that their locals could be used as options for the engine. And, this shortcut is not recommend by ejs.
However, be aware that your code could break if we add an option with the same name as one of your data object's properties. Therefore, we do not recommend using this shortcut. -- from https://www.npmjs.com/package/ejs
I think changing the interface from
(path[, locals], callback)
to
(path[, locals, options], callback)
will be a good solution.
The text was updated successfully, but these errors were encountered: