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

loading handlebars helpers #2538

Open
vinniefalco opened this issue Jun 8, 2023 · 1 comment
Open

loading handlebars helpers #2538

vinniefalco opened this issue Jun 8, 2023 · 1 comment

Comments

@vinniefalco
Copy link

I am integrating duktape + handlebars.js in my C++ program and when I try to duk_peval this code I get an error on line 3:

'use strict'

module.exports = (...args) => {
  const numArgs = args.length
  if (numArgs === 3) return args[0] && args[1]
  if (numArgs < 3) throw new Error('{{and}} helper expects at least 2 arguments')
  args.pop()
  return args.every((it) => it)
}

I get that I need some modules extras/ from the repo, but I looked at the sources to duk_module_node.c and this doesn't affect the parser. Am I correct that duktape 2.7.0 cannot parse this syntax from above (specifically the module.exports = (...args))?

Or am I just confused... full disclosure I am by no means a JS expert. C++ is my primary language. So I do not understand modules that well.

Thanks for any replies!

@vinniefalco
Copy link
Author

It seems I need ECMAScript 6 support, is this coming or here already?

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