{"id":15914696,"url":"https://github.com/trapcodeio/object-collection","last_synced_at":"2025-03-23T01:31:31.800Z","repository":{"id":40002818,"uuid":"189962408","full_name":"trapcodeio/object-collection","owner":"trapcodeio","description":"Break objects into pieces and control them from those pieces.","archived":false,"fork":false,"pushed_at":"2022-12-16T18:38:23.000Z","size":445,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-18T16:15:54.455Z","etag":null,"topics":["collection","javascript","lodash","object"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/trapcodeio.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":"2019-06-03T08:09:05.000Z","updated_at":"2023-12-05T06:34:29.000Z","dependencies_parsed_at":"2023-01-29T15:35:16.503Z","dependency_job_id":null,"html_url":"https://github.com/trapcodeio/object-collection","commit_stats":null,"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trapcodeio%2Fobject-collection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trapcodeio%2Fobject-collection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trapcodeio%2Fobject-collection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trapcodeio%2Fobject-collection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trapcodeio","download_url":"https://codeload.github.com/trapcodeio/object-collection/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245043985,"owners_count":20551860,"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":["collection","javascript","lodash","object"],"created_at":"2024-10-06T17:05:26.643Z","updated_at":"2025-03-23T01:31:31.510Z","avatar_url":"https://github.com/trapcodeio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Javascript object collection.\n\n[**NPM**](https://www.npmjs.com/package/object-collection) |\n[**YARN**](https://yarnpkg.com/en/package/object-collection)\n\nBuilt from **Lodash**'s object functions api.\n\nso instead of `_.extend(obj, data)` you do `data.extend({})`.\n\nAll lodash helpers that **mutates** object returns `this`\n\n### When to use ObjectCollection.\n\nObjectCollection is best used when accessing large objects **e.g** Api data, Your config object e.t.c\n\n### Usage\n\n```javascript\nconst Obj = require(\"object-collection\");\n\n// Creates empty object\nlet data = new Obj();\n// =\u003e {}\n\nconst User = {name: \"John\", age: 32, gender: \"male\"};\n\n// Use already existing object.\nconst user = new Obj(User);\n// =\u003e {name: \"John\", age: 32, gender: 'male'}\n\n// OR Use is a static helper to create new collection instance\nconst user = Obj.use(User);\n// =\u003e {name: \"John\", age: 32, gender: \"male\"}\n\n\nuser.has(\"name\")\n// =\u003e true\n\nuser.pick(['name', 'age']);\n// =\u003e {name: \"John\", age: 32}\n\n\nuser.set({hobbies: ['code', 'eat', 'sleep']});\n// =\u003e {name: \"John\", age: 32, gender: \"male\", hobbies: ['code', 'eat', 'sleep']}\n```\n\nYou get the idea right? All object helpers in `lodash` are available on `this`\n\nWe also added a few more helpers. e.g\n\nIf a path in your object holds an `object` we can access it as a collection using `.path` helper\n\n```javascript\n// Add contact_details to User\nuser.set('contact_details', {\n    address: 'No 1 Astro World', \n    phone: '+123456789',\n    country: 'US',\n});\n\nuser.path(\"contact_details\");\n// Returns message value as a collection\n\nuser.get(\"contact_details.address\");\n//OR\nuser.path(\"contact_details\").get('address');\n// =\u003e No 1 Astro World\n\nuser.path(\"contact_details\").pick(['phone', 'US'])\n// =\u003e {phone: '+123456789', country: 'US'}\n```\n\n#### Full Docs coming soon\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrapcodeio%2Fobject-collection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrapcodeio%2Fobject-collection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrapcodeio%2Fobject-collection/lists"}