Hi,
You can use a rest parameter for this purpose:
return function(...args) {
return func.apply(context, args);
}
In general, rest parameters supersede usages of arguments when it comes to dealing with varargs. Even in regular ES6.
Also, consider using arrow functions in the first place instead, which keep the `this` from the enclosing method/function.
Cheers,
Sébastien
--
You received this message because you are subscribed to the Google Groups "Strengthen JS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to strengthen-j...@googlegroups.com.
To post to this group, send email to streng...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/strengthen-js/ad3a751f-bd61-4c76-94d9-d2124d2cd631%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi,
V8 already supports rest parameters, but you need to enable them with --harmony-rest-parameters. At least that works for me with a d8 I built around a week ago.
To view this discussion on the web, visit https://groups.google.com/d/msgid/strengthen-js/CAJwkOg6o4F_%2Bw6Tut56tCSxWM-hNrkmjqZrYg7aqxUn0wCjWbQ%40mail.gmail.com.