layer

transparently proxies functions, objects

layer

Unobtrusive transparent proxies with very little setup. Doesn't require re-writing existing code. You can just drop it right in!

Runs anywhere there's javascript (browser & node).

--> (layer) --> (function/object)

// add a simple proxy without modifying any existing code! 
var addBig = function(xy) { 
  x = x * 100;
  y = y * 100;
  return [x, y];
}
layer.set(null, add, addBig);
 
// existing code... 
var add = function(xy) {
  return x + y;
}
 
add(2, 2);

And that's it, all instances of calling add() in your existing code now go through addBig() then add()

You don't re-write your code! Or have to call addBig() directly.

layer.set(context, function to proxy, proxy function)

For those times when you want turn the layers down...

func.skip() or following out add example add.skip(2, 2)

layer.unset(func) or following the example: layer.unset(add)