{"id":18905060,"url":"https://github.com/kenberkeley/key-path-mirror","last_synced_at":"2025-04-15T04:12:59.541Z","repository":{"id":43950131,"uuid":"260335913","full_name":"kenberkeley/key-path-mirror","owner":"kenberkeley","description":"Similar to keymirror but supports nested objects, built with TypeScript","archived":false,"fork":false,"pushed_at":"2023-01-06T04:47:31.000Z","size":1495,"stargazers_count":2,"open_issues_count":12,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T04:12:52.624Z","etag":null,"topics":["key-mirror","keymirror","mirror","nested","nested-objects"],"latest_commit_sha":null,"homepage":null,"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/kenberkeley.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":"2020-04-30T22:58:04.000Z","updated_at":"2022-11-15T07:46:59.000Z","dependencies_parsed_at":"2023-02-05T08:35:14.217Z","dependency_job_id":null,"html_url":"https://github.com/kenberkeley/key-path-mirror","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/kenberkeley%2Fkey-path-mirror","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenberkeley%2Fkey-path-mirror/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenberkeley%2Fkey-path-mirror/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenberkeley%2Fkey-path-mirror/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kenberkeley","download_url":"https://codeload.github.com/kenberkeley/key-path-mirror/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249003956,"owners_count":21196793,"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":["key-mirror","keymirror","mirror","nested","nested-objects"],"created_at":"2024-11-08T09:10:30.400Z","updated_at":"2025-04-15T04:12:59.523Z","avatar_url":"https://github.com/kenberkeley.png","language":"TypeScript","readme":"# key-path-mirror\n\n\u003c!-- Stolen from https://git.io/Jf34a --\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://circleci.com/gh/kenberkeley/key-path-mirror/tree/master\"\u003e\u003cimg src=\"https://img.shields.io/circleci/project/github/kenberkeley/key-path-mirror/master.svg?sanitize=true\" alt=\"Build Status\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://npmjs.com/package/key-path-mirror\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/key-path-mirror.svg?sanitize=true\" alt=\"Version\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://npmjs.com/package/key-path-mirror\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/key-path-mirror.svg?sanitize=true\" alt=\"License\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://standardjs.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/code_style-standard-brightgreen.svg\" alt=\"JavaScript Style Guide\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003e Similar to [keymirror](https://www.npmjs.com/package/keymirror) but supports nested objects, built with TypeScript.\n\n## § Installation\n\n```sh\n$ npm i key-path-mirror\n# or\n$ yarn add key-path-mirror\n```\n\n## § Usage\n\n```ts\nimport { keyPathMirror } from 'key-path-mirror'\n\nkeyPathMirror(obj: object, prefix?: string)\n```\n\n## § Examples\n\n\u003e 👉 [REPL online example](https://repl.it/repls/BrightBothDevices)\n\n```ts\nconst nestedObject = {\n  a: 123,\n  b: {\n    c: 'hello',\n    d: {\n      e: 'world'\n    }\n  },\n  f: {\n    g: {\n      h: {\n        i: () =\u003e { console.log('hello world') }\n      },\n      j: 123\n    },\n    k: undefined\n  },\n  l: new Date()\n}\n\nconst expectedKeyPathMirroredObject = {\n  a: 'a',\n  b: {\n    c: 'b.c',\n    d: {\n      e: 'b.d.e'\n    }\n  },\n  f: {\n    g: {\n      h: {\n        i: 'f.g.h.i'\n      },\n      j: 'f.g.j'\n    },\n    k: 'f.k'\n  },\n  l: 'l'\n}\n\nconsole.assert(\n  JSON.stringify(keyPathMirror(nestedObject)) ===\n  JSON.stringify(expectedKeyPathMirroredObject)\n) // no errors :)\n```\n\n```ts\nconst prefix = 'foobar:'\nconst nestedObject = {\n  a: 123,\n  b: {\n    c: 'hello',\n    d: {\n      e: null\n    }\n  }\n}\n\nconst expectedPrefixedKeyPathMirroredObject = {\n  a: 'foobar:a',\n  b: {\n    c: 'foobar:b.c',\n    d: {\n      e: 'foobar:b.d.e'\n    }\n  }\n}\n\nconsole.assert(\n  JSON.stringify(keyPathMirror(nestedObject, prefix)) ===\n  JSON.stringify(expectedPrefixedKeyPathMirroredObject)\n) // no errors :)\n```\n\n## § Alternatives\n\n* https://github.com/tkqubo/deep-key-mirror\n* https://github.com/apolkingg8/KeyMirrorNested\n* https://github.com/werk85/pathmirror\n* https://github.com/venkyjs/KeyMirrorPlus\n* https://github.com/filenwind/keymirror-nested\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenberkeley%2Fkey-path-mirror","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkenberkeley%2Fkey-path-mirror","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenberkeley%2Fkey-path-mirror/lists"}