object-reference-resolver
v1.0.0
Published
Lets you Resolver Objects properties by referencing other objects
Downloads
8
Maintainers
Readme
object-reference-resolver
Lets you Resolve objects with other objects
#Install
npm install object-reference-resolver --save
#Usage
var obj = {
person_id: 'dave',
pet_id: 'snowball',
office_id: 'boston'
};
var objectResolver = new ObjectResolver({
people: {dave: {name: 'dave ecleston'}, dan: {name: 'dan irwin'}, gary: {name: 'gary johnson'}},
pets: {poke: {age: 11}, ralph: {age: 7}, snowball: {age: 3}},
office: {rochester: {zip: 14624}, boston: {zip: 02108}, nyc: {zip: 10001}}
},
{
person: {origin: 'person_id', reference: 'people'},
pet: {origin: 'pet_id', reference: 'pets'},
office: {origin: 'office_id', reference: 'office'}
});
objectResolver(obj)
Results
obj === {
person_id: 'dave',
pet_id: 'snowball',
office_id: "boston",
person: {name: "dave ecleston"},
pet: {
"age": 3
},
office: {
zip: 2108
}
}
);