Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected [object Object] output when variable does not exist #24

Closed
jwellner opened this issue Jan 8, 2018 · 2 comments
Closed

Unexpected [object Object] output when variable does not exist #24

jwellner opened this issue Jan 8, 2018 · 2 comments

Comments

@jwellner
Copy link
Contributor

jwellner commented Jan 8, 2018

I would expect it not to print [object Object] when the variable does not exist. Is this expected behavior or a bug?

Code

var jSmart = require('jsmart');

var compiledTemplate = new jSmart("Variable does not exist: {$variable}");
console.log(compiledTemplate.fetch({}));

Output:

Variable does not exist: [object Object]
@umakantp
Copy link
Owner

Hi

@jwellner this is a bug and thanks for reporting. Ideally, it should print the blank string or 'undefined' string given that the variable is unassigned.

I will take a look at how Smarty PHP behaves.

Thanks

@umakantp
Copy link
Owner

Fixed the bug. Currently, if the variable is undefined, then it will return blank value just like how null does currently. New version will be released as soon as other bugs are fixed. Closing the ticket.

If you any questions, please feel to re-open the ticket. Thanks for reporting the bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants