mde / ejs

Embedded JavaScript templates -- http://ejs.co

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug found

pangqianjin opened this issue · comments

ejs/lib/ejs.js

Line 422 in f47d7ae

utils.shallowCopyFromList(opts, data, _OPTS_PASSABLE_WITH_DATA);

I noticed this line,
it tries to copy the properties from data to opts,
but the function: utils.shallowCopyFromList only returns a new Object,
giving value operation is for the local variable in function itself.

Should also give the returned value to the opts variable in this line will do it work.

In JavaScript, objects are typically passed by reference by default when you pass them as arguments to a function. This means that if you modify the object within the function, the changes will persist outside the function as well.