{"id":16349452,"url":"https://github.com/jednano/get","last_synced_at":"2025-04-04T12:24:19.273Z","repository":{"id":57120809,"uuid":"173368961","full_name":"jednano/get","owner":"jednano","description":"Type-safe get function returns a nested value from an object.","archived":false,"fork":false,"pushed_at":"2023-03-02T20:02:23.000Z","size":398,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-30T02:59:24.199Z","etag":null,"topics":["get","key","nested","object","path","paths","prop","properties","props","typescript","value","values"],"latest_commit_sha":null,"homepage":null,"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/jednano.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}},"created_at":"2019-03-01T21:14:30.000Z","updated_at":"2022-08-31T22:08:17.000Z","dependencies_parsed_at":"2023-07-17T17:24:06.310Z","dependency_job_id":null,"html_url":"https://github.com/jednano/get","commit_stats":null,"previous_names":["jedmao/get"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jednano%2Fget","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jednano%2Fget/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jednano%2Fget/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jednano%2Fget/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jednano","download_url":"https://codeload.github.com/jednano/get/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247176012,"owners_count":20896386,"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":["get","key","nested","object","path","paths","prop","properties","props","typescript","value","values"],"created_at":"2024-10-11T00:59:46.400Z","updated_at":"2025-04-04T12:24:19.252Z","avatar_url":"https://github.com/jednano.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @jedmao/get\n\n[![NPM version](http://img.shields.io/npm/v/@jedmao/get.svg?style=flat)](https://www.npmjs.org/package/@jedmao/get)\n[![npm license](http://img.shields.io/npm/l/@jedmao/get.svg?style=flat-square)](https://www.npmjs.org/package/@jedmao/get)\n[![Travis Build Status](https://img.shields.io/travis/jedmao/get.svg)](https://travis-ci.org/jedmao/get)\n[![codecov](https://codecov.io/gh/jedmao/get/branch/master/graph/badge.svg)](https://codecov.io/gh/jedmao/get)\n[![BundlePhobia Minified](https://badgen.net/bundlephobia/min/@jedmao/get?label=min)](https://bundlephobia.com/result?p=@jedmao/get)\n[![BundlePhobia Minified + gzip](https://badgen.net/bundlephobia/minzip/@jedmao/get?label=min%2Bgzip)](https://bundlephobia.com/result?p=@jedmao/get)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![Unicorn Approved](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://twitter.com/sindresorhus/status/457989012528316416?ref_src=twsrc%5Etfw\u0026ref_url=https%3A%2F%2Fwww.quora.com%2FWhat-does-the-unicorn-approved-shield-mean-in-GitHub)\n\n[![npm](https://nodei.co/npm/@jedmao/get.svg?downloads=true)](https://nodei.co/npm/@jedmao/get/)\n\nType-safe get function returns a nested value from an object.\n\nTypes will be preserved up to 10 levels deep. After that, things start coming back as `any`. This is due to a depth limitation of TypeScript.\n\nThis library is tiny [![BundlePhobia Minified + gzip](https://badgen.net/bundlephobia/minzip/@jedmao/get?label=min%2Bgzip)](https://bundlephobia.com/result?p=@jedmao/get), despite how big it might look if you see the TypeScript source code. Most of what you see is type information, which disappears when compiled into JavaScript, but provides rich in-editor support (see below).\n\n![screenshot](./screenshot.png)\n\n## Installation\n\n```bash\nnpm i @jedmao/get\n```\n\n## Usage\n\n```ts\nimport get from '@jedmao/get'\n\nconst data = {\n  a: {\n    b: [{ c: 'd' }],\n    e: undefined,\n  },\n}\n\nget(data, ['a', 'b', 0, 'c']) // \"d\"\nget(data, ['not-found' as any], 'defaultValue') // \"defaultValue\"\nget(data, ['a', 'e'], 'defaultValue') // undefined\nget(data, ['a', 'e']) || 'fallback' // \"fallback\"\n```\n\nAlso works on functions. If you need to override the input type, you can use `get\u003cT\u003e` in TypeScript.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjednano%2Fget","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjednano%2Fget","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjednano%2Fget/lists"}