ES6 Proxy Function Call Trap

Claude Pache claude.pache at
Tue Jun 9 07:39:13 UTC 2015

> Le 9 juin 2015 à 07:58, Edwin Reynoso <eorroe at> a écrit :
> **Or does someone know how to do what I'm trying to accomplish**

Maybe the following code goes in the direction of what you want?

var people = new Proxy([new Person('Edwin', 'Reynoso'), new Person('That', 'Guy')], {
	get(target, property) {
		if (target[property] !== undefined) 
			return target[property];
		var arr = [];
		for (var person of target) arr.push(person[property]);
		return new Proxy(arr, { 
			apply(target, thisArg, args) { 
				return => Reflect.apply(item, thisArg, args)) 

About your proposal, I recall that, at some point in the history of ES6 draft, there was an `[[Invoke]]` MOP, and a corresponding `invoke` trap for proxies, that were finally eliminated.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list