{"id":22505328,"url":"https://github.com/azer/new-object","last_synced_at":"2025-08-03T11:33:09.996Z","repository":{"id":8277315,"uuid":"9767418","full_name":"azer/new-object","owner":"azer","description":"Objects that you can subscribe to changes.","archived":false,"fork":false,"pushed_at":"2013-07-24T00:41:47.000Z","size":49,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-15T03:09:39.092Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/azer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-30T08:56:00.000Z","updated_at":"2013-12-04T22:44:24.000Z","dependencies_parsed_at":"2022-08-07T01:00:36.142Z","dependency_job_id":null,"html_url":"https://github.com/azer/new-object","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fnew-object","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fnew-object/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fnew-object/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fnew-object/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azer","download_url":"https://codeload.github.com/azer/new-object/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228540841,"owners_count":17934031,"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":[],"created_at":"2024-12-07T00:17:35.439Z","updated_at":"2024-12-07T00:17:35.906Z","avatar_url":"https://github.com/azer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## new-object [![Build Status](https://travis-ci.org/azer/new-object.png)](https://travis-ci.org/azer/new-object)\n\nObjects that you can subscribe to changes. See also: [new-list](https://github.com/azer/new-list)\n\n## Install\n\n```bash\n$ npm install new-object\n```\n\n## Usage\n\n ```js\nprices = newObject({ apple: 3, grape: 4 })\nprices('banana', 1)\n\nprices('apple')\n// =\u003e 3\n\nprices('banana')\n// =\u003e 1\n```\n\nSubscribing to changes:\n\n```js\nprices('cherry', 5)\nprices('apple', 2)\nprices.rm('banana')\n\nprices.subscribe(function(update){\n\n    update.set\n    // =\u003e { cherry: 5, apple: 2 }\n\n    update.rm\n    // =\u003e ['banana']\n\n})\n```\n\n## Publishing Custom Updates\n\n```js\npeople = newObject({ john: { age: 21 city: 'SF' }, smith: { age: 23, city: 'NYC' } })\n\npeople.subscribe(function(update){\n\n  if(update.person)\n    debug('%s was updated', update.person)\n\n})\n\npeople('john').age = 22;\npeople.publish({ person: 'john' })\n\n```\n\nSee tests for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazer%2Fnew-object","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazer%2Fnew-object","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazer%2Fnew-object/lists"}