{"id":21177581,"url":"https://github.com/grjan7/resolve-dotstringkey","last_synced_at":"2026-04-10T01:01:25.160Z","repository":{"id":60394839,"uuid":"541960935","full_name":"grjan7/resolve-dotstringkey","owner":"grjan7","description":"Resolves the dot object notation string to its value.","archived":false,"fork":false,"pushed_at":"2022-10-13T08:10:17.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-24T23:07:31.489Z","etag":null,"topics":["dotted","javascript","json","key-value","mongodb","mql","node","nodejs","npm","npm-package","object","resolve","string","utils"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grjan7.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-09-27T07:37:03.000Z","updated_at":"2023-02-27T07:53:15.000Z","dependencies_parsed_at":"2023-01-19T21:50:30.493Z","dependency_job_id":null,"html_url":"https://github.com/grjan7/resolve-dotstringkey","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/grjan7/resolve-dotstringkey","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grjan7%2Fresolve-dotstringkey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grjan7%2Fresolve-dotstringkey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grjan7%2Fresolve-dotstringkey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grjan7%2Fresolve-dotstringkey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grjan7","download_url":"https://codeload.github.com/grjan7/resolve-dotstringkey/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grjan7%2Fresolve-dotstringkey/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265481969,"owners_count":23773981,"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":["dotted","javascript","json","key-value","mongodb","mql","node","nodejs","npm","npm-package","object","resolve","string","utils"],"created_at":"2024-11-20T17:16:31.343Z","updated_at":"2025-12-30T22:07:12.738Z","avatar_url":"https://github.com/grjan7.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# resolve-dotstringkey\n\n[![NPM version](https://img.shields.io/npm/v/resolve-dotstringkey.svg)](https://www.npmjs.com/package/resolve-dotstringkey)\n[![NPM downloads](https://img.shields.io/npm/dm/resolve-dotstringkey.svg)](https://www.npmjs.com/package/resolve-dotstringkey)\n[![Known Vulnerabilities](https://snyk.io/test/github/grjan7/resolve-dotstringkey/badge.svg)](https://snyk.io/test/github/grjan7/resolve-dotstringkey)\n\n## Description\n\nThis package resolves stringified dot object notation (e.g., \"person.address.city\") to its value. \n\n\u003e It will be useful in parsing and matching nested properties of object (e.g., `{\"person.address.city\": \"New York\"}` as in MongoDB queries).\n\n\u003e Note: use square bracket notation for array indexes and dot notation for object properties. e.g. `addresses[1].city`. \n\n## Installation\n\n```sh\n$ npm i resolve-dotstringkey\n```\n## Usage\n\n### resolveDotStringKey(rootObject, dottedString)\n\n  - **rootObject** | datatype: object | default: none | required\n  - **dottedString** | datatype: string | default: none | required\n  - **returns** | datatype: any \n\n#### Examples:\n\n```js\n  const resolveKey = require(\"resolve-dotstringkey\");\n\n  const persons = [{\n    name: \"John\",\n    age: 28,\n    contacts: [{\n      address: { city: \"New York\", state: \"NY\", country: \"USA\" },\n      phone: \"+1 20000 50000\"\n    },\n    {\n      address: { city: \"New Jersey\", state: \"NJ\", country: \"USA\" },\n      phone: \"+1 21421 41254\"\n    }] \n  },\n  {\n    name: \"Robin\",\n    age: 40,\n    contacts: [{\n      address: { city: \"New York\", state: \"NY\", country: \"USA\" },\n      phone: \"+1 21426 41255\"\n    }] \n  }]\n```\n\n##### Case 1:\n\n```js \n  resolveKey(persons, \"[0].name\") // returns \"John\"\n```\n##### Case 2:\n\n```js\n  resolveKey(persons, \"[0].contacts[1].address.city\") // returns \"New Jersey\"\n```\n##### Case 3:\n\n```js\n  resolveKey(persons, \"[0].contacts\") \n```\nreturns\n\n```js\n\n  [\n    {\n      address: { city: \"New York\", state: \"NY\", country: \"USA\" },\n      phone: \"+1 20000 50000\"\n    },\n    {\n      address: { city: \"New Jersey\", state: \"NJ\", country: \"USA\" },\n      phone: \"+1 21421 41254\"\n    }\n  ]\n\n```\n##### Case 4:\n\n```js\n  resolveKey(persons) \n```\nreturns\n\n```js\n  [{\n    name: \"John\",\n    age: 28,\n    contacts: [{\n      address: { city: \"New York\", state: \"NY\", country: \"USA\" },\n      phone: \"+1 20000 50000\"\n    },\n    {\n      address: { city: \"New Jersey\", state: \"NJ\", country: \"USA\" },\n      phone: \"+1 21421 41254\"\n    }] \n  },\n  {\n    name: \"Robin\",\n    age: 40,\n    contacts: [{\n      address: { city: \"New York\", state: \"NY\", country: \"USA\" },\n      phone: \"+1 21426 41255\"\n    }] \n  }]\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrjan7%2Fresolve-dotstringkey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrjan7%2Fresolve-dotstringkey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrjan7%2Fresolve-dotstringkey/lists"}