Skip to content

dbo/es2015-proxy-shim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

es2015-proxy-shim Build Status npm semantic-release Commitizen friendly

An ES2015 Proxy shim that relies on a non-extensible fixed set of properties at the time of proxying a target object or function.

This shim is limited to a few supported traps:

  • construct, apply (on functions)
  • get, set

This shim relies on a decent ES2015 support, e.g.

  • for-of loops
  • symbols
  • WeakMap
  • Reflect

Use shims like core-js, if needed.

This shim patches Reflect.set which needs to walk in sync w.r.t. proxy objects.

Install

$ npm install es2015-proxy-shim --save

Usage

require("core-js/shim");
require("es2015-proxy-shim");

var p = new Proxy({ foo: 5 }, {
    get: function(t, k, r) {
        console.log("#get", t, k);
        return Reflect.get(t, k, r);
    }
});
p.foo = 8;
console.log("is", p.foo);

License

MIT © Daniel Bölzle