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

rendered output is nested further into the array with each call #3

Open
speciesunknown opened this issue Sep 3, 2016 · 0 comments
Open

Comments

@speciesunknown
Copy link

Hello

I'm finding that if there is more than one call to render the same template file, the results get nested further into an array with each call.
swig template:

select {% bind fn %} AS solution

js code:

var swigql = require('swigql');

var params = {
    fn: 'J\'ames',
    last_names: ['Franklin', 'Cooper', 'Smitty', 'Black']
};

var tmpl1 = swigql.compileFile(process.cwd() + "/example.sql");
console.log(tmpl1.render(params));

var tmpl2 = swigql.compileFile(process.cwd() + "/example.sql");
console.log(tmpl2.render(params));
$ node test.js
[ 'select $1 AS solution', [ 'J\'ames' ] ]
[ [ 'select $1 AS solution', [ 'J\'ames' ] ], [ 'J\'ames' ] ]

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

No branches or pull requests

1 participant