Created
December 24, 2018 15:12
-
-
Save evanxg852000/a8a03f5150f117af0792df7eb75ea323 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Templater { | |
... | |
generate(ast){ | |
return `module.exports = function (context) { | |
context = context || {} | |
for(let varname of Object.keys(context)){ | |
this[varname]= context[varname] | |
} | |
let __njsOutput = '' | |
${ast.generate()} | |
return __njsOutput | |
}` | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment