{"id":15354914,"url":"https://github.com/capaj/object-resolve-path","last_synced_at":"2025-08-21T06:30:40.351Z","repository":{"id":57312733,"uuid":"39956235","full_name":"capaj/object-resolve-path","owner":"capaj","description":"a simple utility function for getting a value at a path from an object with all the usecases properly covered","archived":false,"fork":false,"pushed_at":"2018-12-28T14:17:02.000Z","size":25,"stargazers_count":66,"open_issues_count":3,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-10T07:12:39.978Z","etag":null,"topics":[],"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/capaj.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":"2015-07-30T14:56:23.000Z","updated_at":"2023-02-20T20:32:45.000Z","dependencies_parsed_at":"2022-09-20T23:02:36.629Z","dependency_job_id":null,"html_url":"https://github.com/capaj/object-resolve-path","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fobject-resolve-path","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fobject-resolve-path/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fobject-resolve-path/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fobject-resolve-path/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/capaj","download_url":"https://codeload.github.com/capaj/object-resolve-path/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230494921,"owners_count":18235046,"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-10-01T12:21:39.286Z","updated_at":"2024-12-19T20:08:06.108Z","avatar_url":"https://github.com/capaj.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# object-resolve-path\na simple utility function for getting a value at a path from an object with all the usecases properly covered.\nBased on Path pseodoclass from https://github.com/Polymer/observe-js/blob/7e94bb14d7c44b221af7bcc874cf9898f26747d8/src/observe.js#L305\n\n## Install\n```\nnpm i object-resolve-path -S\n```\n\n## Usage\n\n```javascript\nconst resolvePath = require('object-resolve-path');\nresolvePath(someObject, 'a.b[0]');\t//returns first property from b from a from someObject\nresolvePath(someObject, 'a[\"b-a\"][0]');\t//this works as well, thanks to the parser/statemachine\n//with variables\nconst someId = 'some-id'\nresolvePath(someObject, `a.b['${someId}']`); //return key 'some-id' from the nested a.b object\n```\n\n## Typical usecase?\nMost other libraries for accessing deeply nested properties of an object don't work with bracket syntax. This one does work with bracket syntax.\n\nFor thorough description, check the [tests](https://github.com/capaj/object-resolve-path/blob/master/test/object-resolve-path.spec.js).\n\n### Similar modules:\n\nhttps://www.npmjs.com/package/lodash.get (works for both but much much slower, doesn't throw when path is not valid, object-resolve-path does)\n\nhttps://github.com/deoxxa/dotty (works only for dots)\n\nhttps://github.com/Ntran013/dot-access  (works only for dots)\n\nhttps://github.com/substack/js-traverse (much more complex and useful)\n\n\n## Benchmarks\n\n```\nnode benchmark.js\nlodash.get x 2,253,484 ops/sec ±0.83% (94 runs sampled)\nobject-resolve-path x 39,876,349 ops/sec ±0.82% (92 runs sampled)\nFastest is object-resolve-path\n\n```\n\n[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapaj%2Fobject-resolve-path","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapaj%2Fobject-resolve-path","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapaj%2Fobject-resolve-path/lists"}