Referencejs
Referencejs manages references to values in plain JS or Immutable objects (called stores). You can use this to:
- Easily manage complex denormalized, without needing an explicited schema
- referencing data that doesn't exist yet (e.g. async data)
- normalize and denormalize immutable data
- Lazily denormalize stored data
Getting Started
Update a Plain store
;const jon = id: 'user_1' name: 'John Doe' email: 'jon@doe.com';const jonRefrence = ; let store = {};store = ; === jon;
Or use Immutable if that's your jam
;;const jon = Map id: 'user_1' name: 'John Doe' email: 'jon@doe.com';const jonRefrence = ; let store = Map;store = ; ;
smartDereference
More Advanced: Dereferencing one reference at a time can be painful.
smartDereference
scans an object or array and dereferences every reference it finds
; const store = users: user1: name: 'John Doe' user2: name: 'Jane Doe' user3: name: 'Billy Doe' user4: name: 'Lucy Doe' ; const john = ;const jane = ;const billy = ;const lucy = ; const familyTreeReferences = father: john mother: jane children: billy lucy; // familyTree will contain the user objects instead of the references const familyTree = ;