{"id":21874512,"url":"https://github.com/smoren/nested-accessor-ts","last_synced_at":"2026-05-20T10:16:17.509Z","repository":{"id":64534417,"uuid":"575765072","full_name":"Smoren/nested-accessor-ts","owner":"Smoren","description":"Accessor for getting and setting values of nested data structures (arrays or objects)","archived":false,"fork":false,"pushed_at":"2022-12-08T14:49:03.000Z","size":39,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-12T13:52:29.179Z","etag":null,"topics":["accessor","nested-structures","ts","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Smoren.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-12-08T08:46:23.000Z","updated_at":"2022-12-19T16:44:56.000Z","dependencies_parsed_at":"2022-12-15T03:26:35.776Z","dependency_job_id":null,"html_url":"https://github.com/Smoren/nested-accessor-ts","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smoren%2Fnested-accessor-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smoren%2Fnested-accessor-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smoren%2Fnested-accessor-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smoren%2Fnested-accessor-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Smoren","download_url":"https://codeload.github.com/Smoren/nested-accessor-ts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244881225,"owners_count":20525612,"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":["accessor","nested-structures","ts","typescript"],"created_at":"2024-11-28T07:12:33.896Z","updated_at":"2026-05-20T10:16:17.161Z","avatar_url":"https://github.com/Smoren.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nested-accessor\n\nAccessor for getting and setting values of nested data structures (arrays or objects).\n\n### Unit testing\n```\nnpm i\nnpm run test\n```\n\n### Usage\n\n#### NestedAccessor\n\n```ts\n\nconst source = {\n  \"data\": {\n    \"id\": 1,\n    \"name\": \"Countries classifier\"\n  },\n  \"countries\": [{\n    \"name\": \"Russia\",\n    \"cities\": [{\n      \"name\": \"Moscow\",\n      \"extra\": {\n        \"codes\": [{\n          \"value\": 7495\n        },\n          {\n            \"value\": 7499\n          }\n        ]\n      }\n    },\n      {\n        \"name\": \"Petersburg\",\n        \"extra\": {\n          \"codes\": [{\n            \"value\": 7812\n          }]\n        }\n      }\n    ]\n  },\n    {\n      \"name\": \"Belarus\",\n      \"cities\": [{\n        \"name\": \"Minsk\",\n        \"extra\": {\n          \"codes\": [{\n            \"value\": 375017\n          }]\n        }\n      }]\n    }\n  ]\n};\n\nconst accessor = new NestedAccessor(input);\n\nconsole.log(accessor.get('data.name')); // 'Countries classifier'\nconsole.log(accessor.get('countries.name')); // ['Russia', 'Belarus']\nconsole.log(accessor.get('countries.cities.name')); // ['Moscow', 'Petersburg', 'Minsk']\nconsole.log(accessor.get('countries.cities.extra.codes.value')); // [7495, 7499, 7812, 375017]\n\naccessor.set('data.name', 'New name');\nconsole.log(accessor.get('data.name')); // 'New name'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmoren%2Fnested-accessor-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmoren%2Fnested-accessor-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmoren%2Fnested-accessor-ts/lists"}