Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

object-reference-resolver

1.0.0 • Public • Published

object-reference-resolver

Lets you Resolve objects with other objects

npm version dependencies Build Status Pledge To Arupex!

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
        }
    }
  );

install

npm i object-reference-resolver

Downloadsweekly downloads

1

version

1.0.0

license

UNLICENSED

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability