patch-as

Patch ugly property names with a proxy to a better one.

npm install patch-as
1 downloads in the last week
4 downloads in the last month

patch-as

Patch ugly property names with a proxy to a better one.

usage


var assert = require('assert');
var as = require('..');

// create patch

var patch = as({
  'n': 'name',
  'e': 'email'
});

// apply it

patch(obj);

// gets

assert.equal(obj.n, 'john doe');
assert.equal(obj.n, obj.name);

// sets

obj.n = 'jane doe';
assert.equal(obj.n, 'jane doe');
assert.equal(obj.n, obj.name);

// sets (again)

obj.name = 'buzz doe';
assert.equal(obj.name, 'buzz doe');
assert.equal(obj.name, obj.n);

license

MIT

npm loves you