Note
Segment has paused maintenance on this project, but may return it to an active status in the future. Issues and pull requests from external contributors are not being considered, although internal contributions may appear from time to time. The project remains available under its open source license for anyone to use.
Change an object's keys to new keys.
$ component install segmentio/alias
$ npm install @segment/alias
By dictionary:
var alias = require('alias');
var obj = { a: 1 };
alias(obj, { a: 'b' });
// { b: 1 }
By function:
var alias = require('alias');
var obj = { a: 1 };
alias(obj, function (key) { return key + key; });
// { aa: 1 }
Changes an object
's keys using a dictionary
of new key names, or a convert
function.
MIT