{"id":16368681,"url":"https://github.com/aigoncharov/metadata-utils","last_synced_at":"2026-02-26T22:30:20.878Z","repository":{"id":57124231,"uuid":"178560171","full_name":"aigoncharov/metadata-utils","owner":"aigoncharov","description":"Convenience utils for reflected metadata","archived":false,"fork":false,"pushed_at":"2019-03-30T14:42:21.000Z","size":64,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-18T09:07:16.768Z","etag":null,"topics":["metadata","reflect","reflection","typescript"],"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/aigoncharov.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":"2019-03-30T13:10:49.000Z","updated_at":"2022-11-17T16:38:23.000Z","dependencies_parsed_at":"2022-08-31T06:51:45.996Z","dependency_job_id":null,"html_url":"https://github.com/aigoncharov/metadata-utils","commit_stats":null,"previous_names":["keenondrums/metadata-utils"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aigoncharov%2Fmetadata-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aigoncharov%2Fmetadata-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aigoncharov%2Fmetadata-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aigoncharov%2Fmetadata-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aigoncharov","download_url":"https://codeload.github.com/aigoncharov/metadata-utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239869221,"owners_count":19710485,"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":["metadata","reflect","reflection","typescript"],"created_at":"2024-10-11T02:53:31.522Z","updated_at":"2025-02-20T16:14:20.601Z","avatar_url":"https://github.com/aigoncharov.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# metadata-utils [![Build Status](https://travis-ci.org/keenondrums/metadata-utils.svg?branch=master)](https://travis-ci.org/keenondrums/metadata-utils) [![Coverage Status](https://coveralls.io/repos/github/keenondrums/metadata-utils/badge.svg?branch=master)](https://coveralls.io/github/keenondrums/metadata-utils?branch=master) [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Convenience%20utils%20for%20reflected%20metadata\u0026url=https://github.com/keenondrums/metadata-utils\u0026hashtags=javascript,typescript,metadata,reflection)\n\nConvenience utils for reflected metadata.\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n- [Installation](#installation)\n- [API](#api)\n  - [getMetadataAndCache](#getmetadataandcache)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Installation\n\n1. Run\n\n   ```sh\n   npm i @keenondrums/metadata-utils reflect-metadata\n   ```\n\n1. Add `import 'reflect-metadata'` to the root of your application\n\n## API\n\n### getMetadataAndCache\n\nGets metadata from the prototype (using [Relect.getMetadata](https://github.com/rbuckton/reflect-metadata#api)) and sets it as own metadata. Useful to enhance performance for retrieving metadata from ancestors. Has the same signature as [Relect.getMetadata](https://github.com/rbuckton/reflect-metadata#api).\n\n```ts\nimport 'reflect-metadata'\nimport { getMetadataAndCache } from '@keenondrums/metadata-utils'\n\nclass Parent {}\nReflect.defineMetadata('key', 'value', Parent)\n\nReflect.getOwnMetadata('key', Parent) // returns 'value'\ngetMetadataAndCache('key', Parent) // returns 'value', basically calls Reflect.getOwnMetadata under the hood and does nothing else in this case\n\nclass Child extends Parent {}\n\nReflect.getOwnMetadata('key', Child) // returns `undefined` as Child doesn't have any own metadata for 'key'\ngetMetadataAndCache('key', Child) // returns 'value' from Parent and set it as own metadata\nReflect.getOwnMetadata('key', Child) // now it returns 'value'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faigoncharov%2Fmetadata-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faigoncharov%2Fmetadata-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faigoncharov%2Fmetadata-utils/lists"}