{"id":16256918,"url":"https://github.com/prazdevs/deep-pick-omit","last_synced_at":"2025-03-19T21:31:16.937Z","repository":{"id":211774903,"uuid":"729911174","full_name":"prazdevs/deep-pick-omit","owner":"prazdevs","description":"⛏️ Deep-pick and deep-omit objects with typesafe paths.","archived":false,"fork":false,"pushed_at":"2024-10-04T20:36:04.000Z","size":362,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T23:27:15.007Z","etag":null,"topics":["typescript","utilities"],"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/prazdevs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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":{"ko_fi":"prazdevs","github":"prazdevs"}},"created_at":"2023-12-10T18:18:25.000Z","updated_at":"2024-10-04T20:36:08.000Z","dependencies_parsed_at":"2023-12-10T20:24:40.510Z","dependency_job_id":"8c01cc0a-5491-438a-93e0-34df498b81f2","html_url":"https://github.com/prazdevs/deep-pick-omit","commit_stats":null,"previous_names":["prazdevs/deep-pick-omit"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prazdevs%2Fdeep-pick-omit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prazdevs%2Fdeep-pick-omit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prazdevs%2Fdeep-pick-omit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prazdevs%2Fdeep-pick-omit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prazdevs","download_url":"https://codeload.github.com/prazdevs/deep-pick-omit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244056428,"owners_count":20390720,"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":["typescript","utilities"],"created_at":"2024-10-10T15:46:42.799Z","updated_at":"2025-03-19T21:31:16.589Z","avatar_url":"https://github.com/prazdevs.png","language":"TypeScript","funding_links":["https://ko-fi.com/prazdevs","https://github.com/sponsors/prazdevs"],"categories":[],"sub_categories":[],"readme":"# deep-pick-omit\n\n[![npm version][version-src]][version-href]\n[![bundlephobia][bundle-src]][bundle-href]\n[![license][license-src]][license-href]\n\n\u003e Deep-pick and deep-omit objects with typesafe paths.\n\n## Basic usage\n\nBoth `deepPick` and `deepOmit` take an object and an array of dot-notation paths to respectively pick and omit from the object. By default, TypeScript will infer types for paths and error if a path does not exist in the object.\n\n### `deepPick`\n\n```typescript\nimport { deepPick } from 'deep-pick-omit'\n\nconst obj = {\n  a: {\n    b: 'this',\n    c: 'not this'\n  },\n  d: 'this'\n}\n\ndeepPick(obj, ['a.b', 'e'])\n// -\u003e { a: { b: 'this' }, d: 'this' }\n\ndeepPick(obj, ['f'])\n// -\u003e TypeScript Error: `f` is not a key of `obj`\n```\n\n### `deepOmit`\n\n```typescript\nimport { deepOmit } from 'deep-pick-omit'\n\nconst obj = {\n  a: {\n    b: 'this',\n    c: 'not this'\n  },\n  d: 'this'\n}\n\ndeepOmit(obj, ['a.c'])\n// -\u003e { a: { b: 'this' }, d: 'this' }\n\ndeepOmit(obj, ['f'])\n// -\u003e TypeScript Error: `f` is not a key of `obj`\n```\n\n\u003e [!NOTE]\n\u003e Pathing through array values is not allowed typesafe path methods. See [unsafe methods](#unsafe-methods).\n\n## Unsafe methods\n\nIf paths type-safety is a problem for some edge cases, the package exposes the same methods without the type-checking on paths.\n\n### `deepPickUnsafe`\n\n```typescript\nimport { deepPickUnsafe } from 'deep-pick-omit'\n\nconst obj = {\n  a: {\n    c: 'not this'\n  },\n  d: 'this'\n}\n\ndeepPickUnsafe(obj, ['d', 'f'])\n// -\u003e { d: 'this' }\n```\n\n### `deepOmitUnsafe`\n\n```typescript\nimport { deepOmitUnsafe } from 'deep-pick-omit'\n\nconst obj = {\n  a: {\n    b: 'this',\n    c: 'not this'\n  },\n  d: 'this'\n}\n\ndeepOmitUnsafe(obj, ['a.c', 'f'])\n// -\u003e { a: { b: 'this' }, d: 'this' }\n```\n\n## License\n\n[MIT](./LICENSE) — Made with 💖.\n\n\u003c!-- Badges --\u003e\n\n[version-src]: https://img.shields.io/npm/v/deep-pick-omit?style=flat-square\u0026labelColor=313244\u0026color=f38ba8\n[version-href]: https://npmjs.com/package/deep-pick-omit\n[bundle-src]: https://img.shields.io/bundlephobia/minzip/deep-pick-omit?style=flat-square\u0026labelColor=313244\u0026color=f38ba8\n[bundle-href]: https://bundlephobia.com/result?p=deep-pick-omit\n[license-src]: https://img.shields.io/github/license/prazdevs/deep-pick-omit?style=flat-square\u0026labelColor=313244\u0026color=f38ba8\n[license-href]: https://github.com/prazdevs/deep-pick-omit/blob/main/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprazdevs%2Fdeep-pick-omit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprazdevs%2Fdeep-pick-omit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprazdevs%2Fdeep-pick-omit/lists"}