That's very nice, thanks.

On Wed, Oct 5, 2011 at 12:23 PM, Andrea Giammarchi <
[email protected]> wrote:

> dunno how we ended up here but I would rather use this approach in a
> private scope:
>
> var
>     // used to trap function calls via bind
>     invoke = Function.call,
>     // normal use cases
>     bind = invoke.bind(invoke.bind),
>     apply = bind(invoke, invoke.apply),
>     call = bind(invoke, invoke)
> ;
>
> var hasOwnProperty = bind(invoke, {}.hasOwnProperty);
>
> hasOwnProperty({key:1}, "key"); // true
> call([].slice, [1,2,3], 1);     // 2,3
> apply([].slice, [1,2,3], [1]);  // 2,3
>
> Regards,
>     Andrea Giammarchi
>



-- 
    Cheers,
    --MarkM
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to