Object Alias
Creates an alias object to another object.
Sometimes you need to accept an object in one format and map the object to a different format to use it in a different service. Object-Alias allows you to create this mapping in a compressed format using json-pointers.
Installation
npm install object-alias
Usage
Create an alias
var source = rootProp: 'foo' deep: prop: 'bar' alias = source; alias;console; // foo alias;console; // bar alias;console; // bar
Parse values from one format to another
var source = id: '0-0-2' alias = source; alias; console; //2 aliasid = 3;console; //'0-0-3'
Use an alternative source
var source2 = prop: 'bar' ;// ... alias;console; // bar
Create multiple aliases
var definitions = '#/rootProp' '#/myProp' '#/deep/prop' '#/yourProp' // You can use slash (/) or dot (.) as delimiter. #/ in the beginning is optional 'deep.prop' 'your.prop' 'prop' 'foo' null source2 '#/id' '#/id' {} {} ; alias = source definitions;
TODO
Implement the full json-pointer syntax