What is the recommended way of enforcing arity under ECMAScript 6 (while
avoiding arguments.length)?
Two ideas:
1. Parameter default value is a function call that throws an exception. Not
sure if that works.
function foo(required = throwAnException(), optional) { ... }
2. Introduce a postfix `!` matching operator, the inverse of postfix `?`:
function foo(required!, optional) { ... }
--
Dr. Axel Rauschmayer
[email protected]
home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss