{"id":22222024,"url":"https://github.com/fabiospampinato/path-prop","last_synced_at":"2025-07-17T23:06:44.850Z","repository":{"id":57154474,"uuid":"212996784","full_name":"fabiospampinato/path-prop","owner":"fabiospampinato","description":"Fast library for manipulating plain objects using paths.","archived":false,"fork":false,"pushed_at":"2023-09-24T16:28:50.000Z","size":20,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-24T21:46:00.259Z","etag":null,"topics":["delete","flat","get","has","object","path","prop","remove","set","unflat"],"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/fabiospampinato.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"fabiospampinato","custom":"https://www.paypal.me/fabiospampinato"}},"created_at":"2019-10-05T12:37:13.000Z","updated_at":"2024-04-03T14:43:03.000Z","dependencies_parsed_at":"2024-06-19T17:10:53.431Z","dependency_job_id":"db3f0512-42f8-490c-ae8c-c0d0b4bdd314","html_url":"https://github.com/fabiospampinato/path-prop","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/fabiospampinato/path-prop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fpath-prop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fpath-prop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fpath-prop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fpath-prop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabiospampinato","download_url":"https://codeload.github.com/fabiospampinato/path-prop/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fpath-prop/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265677346,"owners_count":23809949,"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":["delete","flat","get","has","object","path","prop","remove","set","unflat"],"created_at":"2024-12-02T23:16:34.939Z","updated_at":"2025-07-17T23:06:44.827Z","avatar_url":"https://github.com/fabiospampinato.png","language":"JavaScript","funding_links":["https://github.com/sponsors/fabiospampinato","https://www.paypal.me/fabiospampinato"],"categories":[],"sub_categories":[],"readme":"# Path Prop\n\nFast library for manipulating plain objects using paths.\n\nThis library is similar to [dot-prop](https://github.com/sindresorhus/dot-prop), but it achieves up to 3x better performance, it offers a couple of additional methods for dealing with flat objects and it has a few more restrictions.\n\n## Features\n\n- **Performant**: it is up to 3x faster than [dot-prop](https://github.com/sindresorhus/dot-prop).\n- **Lightweight**: it has just a few tiny dependencies and it's comprised of about 200 lines of code.\n- **Flat objects**: a few additional methods are provided for flattening and unflattening objects.\n\n## Restrictions\n\nIn order to achieve maximum performance a few limitations/restrictions have been introduced:\n\n- If a property is set to `undefined` it will be considered as not set.\n- There's no way to escape dots in paths.\n- It's only supposed to manipulate objects, not functions etc.\n- It doesn't check if a property is owned or enumerable.\n\n## Install\n\n```sh\nnpm install --save path-prop\n```\n\n## Usage\n\n```ts\nimport pp from 'path-prop';\n\n/* GET */\n\nlet object = { foo: { bar: 123 } };\n\npp.get ( object, 'foo' ); // =\u003e { bar: 123 }\npp.get ( object, 'foo.bar' ); // =\u003e 123\npp.get ( object, 'foo.bar.baz' ); // =\u003e undefined\npp.get ( object, 'foo.bar.baz', 1 ); // =\u003e 1\n\n/* HAS */\n\nobject = { foo: { bar: 123 } };\n\npp.has ( object, 'foo' ); // =\u003e true\npp.has ( object, 'foo.bar' ); // =\u003e true\npp.has ( object, 'foo.bar.baz' ); // =\u003e false\n\n/* SET */\n\npp.set ( { foo: { bar: 123 } }, 'bar', 1 ); // =\u003e { foo: { bar: 123 }, bar: 1 }\npp.set ( { foo: { bar: 123 } }, 'foo.bar', 1 ); // =\u003e { foo: { bar: 1 } }\npp.set ( { foo: { bar: 123 } }, 'foo.bar.baz', 1 ); // =\u003e { foo: { bar: { baz: 1 } } }\n\n/* DELETE */\n\nobject = { foo: { bar: 123 } };\n\npp.delete ( object, 'foo.bar' ); // =\u003e undefined\nconsole.log ( object ); // =\u003e { foo: {} }\n\n/* FLAT */\n\nobject = { foo: { bar: 123, baz: 'test' }, bar: 1 };\n\npp.flat ( object ); // =\u003e { 'foo.bar': 123, 'foo.baz': 'test', bar: 1 }\n\n/* UNFLAT */\n\nobject = { 'foo.bar': 123, 'foo.baz': 'test', bar: 1 };\n\npp.unflat ( object ); // =\u003e { foo: { bar: 123, baz: 'test' }, bar: 1 }\n```\n\n## API\n\n### `get ( object, path, fallback? )`\n\nGets the value at `path`, returning `fallback` if it's not set.\n\n### `has ( object, path )`\n\nChecks if a value is set at `path`.\n\n### `set ( object, path, value )`\n\nSets `value` at `path`.\n\n### `delete ( object, path )`\n\nDeletes the value at `path`.\n\n### `flat ( object )`\n\nTransforms a potentially deep object into a flat object.\n\n### `unflat ( object )`\n\nTransforms a flat object into a potentially deep object.\n\n## License\n\nMIT © Fabio Spampinato\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Fpath-prop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabiospampinato%2Fpath-prop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Fpath-prop/lists"}