Function length

John Tamplin jat at google.com
Sun Jun 10 15:44:21 PDT 2012


On Sun, Jun 10, 2012 at 12:48 PM, Irakli Gozalishvili <rfobic at gmail.com>wrote:

>  Never the less problem still stands, but maybe there are other ways to
> solve it. Only solution I'm left with so far is utility function like this:
>
> function hasRest(f) {
>   return !!~String(f).split('\n').shift().indexOf('...')
> }
>
> Which is bad, specially toString of function is not guaranteed to return
> source.
>
> Maybe alternative solution could be some standard function / method to
> test if the function captures ...rest args.
>

You could imagine a method like Function.prototype.hasRestArgs, but that
wouldn't catch the existing varargs-style coding based on arguments.

-- 
John A. Tamplin
Software Engineer (GWT), Google
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120610/5ec70815/attachment.html>


More information about the es-discuss mailing list