undefined appearing in function definitions? #11

Closed
furtivefelon opened this Issue May 11, 2012 · 5 comments

Projects

None yet

3 participants

@furtivefelon

Hi all,

I am using the following code to try out escodegen:

var source = "var hello = function(){return 'hello world!';}; var hello1 = world; function world(hello){return hello;} var number = function(num){return num;}; hello(); var hello2 = 1+1*number(1)"
var res = esprima.parse(source);
escodegen.generate(res)

the output on my end is:

"var hello = function () {
undefinedreturn 'hello world!';
}; 
var hello1 = world;
function world(hello) {
undefinedreturn hello;
}
var number = function (num) {
undefinedreturn num;
};
hello();
var hello2 = 1 + 1 * number(1);"

The problem is with all the "undefined" appearing in the function body. Any help would be appreciated :)

Jason

@michaelficarra
Member

It looks like it's outputting undefined instead of indentation.

edit: Are you providing an options argument with an indent value of undefined? See https://github.com/Constellation/escodegen/wiki/API

@furtivefelon

I am not providing any indent options, but if i do indent: '' it works fine :)

@Constellation
Member

Oops!
I'll see it and fix soon! Thanks!

@Constellation
Member

Landed! Thanks!

@furtivefelon

Thanks a lot! Very prompt fix :)

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