{"id":24836749,"url":"https://github.com/mindblight/referencejs","last_synced_at":"2026-05-01T10:32:06.087Z","repository":{"id":57352042,"uuid":"87039488","full_name":"mindblight/referencejs","owner":"mindblight","description":null,"archived":false,"fork":false,"pushed_at":"2017-05-02T19:17:08.000Z","size":137,"stargazers_count":0,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2024-04-25T09:22:48.036Z","etag":null,"topics":["denormalize","normalize","redux","reference"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mindblight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-03T04:59:03.000Z","updated_at":"2017-12-15T02:33:06.000Z","dependencies_parsed_at":"2022-08-29T21:00:17.354Z","dependency_job_id":null,"html_url":"https://github.com/mindblight/referencejs","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindblight%2Freferencejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindblight%2Freferencejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindblight%2Freferencejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindblight%2Freferencejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mindblight","download_url":"https://codeload.github.com/mindblight/referencejs/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245585807,"owners_count":20639671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["denormalize","normalize","redux","reference"],"created_at":"2025-01-31T05:18:19.327Z","updated_at":"2026-05-01T10:32:01.053Z","avatar_url":"https://github.com/mindblight.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Referencejs [![Build Status](https://travis-ci.org/mindblight/referencejs.svg?branch=master)](https://travis-ci.org/mindblight/referencejs)\n\nReferencejs manages references to values in plain JS or [Immutable](https://facebook.github.io/immutable-js/) objects (called stores). You can use this to:\n\n1. Easily manage complex denormalized, without needing an explicited schema\n2. referencing data that doesn't exist yet (e.g. async data)\n3. normalize and denormalize immutable data\n4. Lazily denormalize stored data\n\n\n## Getting Started\nUpdate a Plain store\n```js\nimport { createReference, resolveReference, dereference } from 'referencejs';\nconst jon = {\n  id: 'user_1',\n  name: 'John Doe',\n  email: 'jon@doe.com'\n};\nconst jonRefrence = createReference('auth', 'users', jon.id);\n\nlet store = {};\nstore = resolveReference(store, jonReference, jon);\n\ndereference(store, jonRefrence) === jon;\n```\n\nOr use [Immutable](https://facebook.github.io/immutable-js/) if that's your jam\n```js\nimport { Map, is } from 'immutable';\nimport { createReference, resolveReference, dereference } from 'referencejs/immutable';\nconst jon = Map({\n  id: 'user_1',\n  name: 'John Doe',\n  email: 'jon@doe.com'\n});\nconst jonRefrence = createReference('auth', 'users', jon.id);\n\nlet store = Map();\nstore = resolveReference(store, jonReference, jon);\n\nis(dereference(store, jonRefrence), jon);\n```\n\n## More Advanced: `smartDereference`\nDereferencing one reference at a time can be painful.\n`smartDereference` scans an object or array and dereferences every reference it finds\n\n```js\nimport {\n  createReference,\n  smartDereference,\n} from 'referencejs';\n\nconst store = {\n  users: {\n    user1: {\n      name: 'John Doe'\n    },\n    user2: {\n      name: 'Jane Doe'\n    },\n    user3: {\n      name: 'Billy Doe'\n    },\n\n    user4: {\n      name: 'Lucy Doe'\n    }\n  }\n};\n\nconst john = createReference(['users', 'user1']);\nconst jane = createReference(['users', 'user2']);\nconst billy = createReference(['users', 'user3']);\nconst lucy = createReference(['users', 'user4']);\n\nconst familyTreeReferences = {\n  father: john,\n  mother: jane,\n  children: [billy, lucy]\n};\n\n// familyTree will contain the user objects instead of the references  \nconst familyTree = smartDereference(store, familyTree);\n```\n\n## Like what you see?\n- [Read the docs](docs/README.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindblight%2Freferencejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmindblight%2Freferencejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindblight%2Freferencejs/lists"}