Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@keenondrums/metadata-utils

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@keenondrums/metadata-utils

Convenience utils for reflected metadata

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

metadata-utils Build Status Coverage Status Tweet

Convenience utils for reflected metadata.

Installation

  1. Run

    npm i @keenondrums/metadata-utils reflect-metadata
    
  2. Add import 'reflect-metadata' to the root of your application

API

getMetadataAndCache

Gets metadata from the prototype (using Relect.getMetadata) and sets it as own metadata. Useful to enhance performance for retrieving metadata from ancestors. Has the same signature as Relect.getMetadata.

import 'reflect-metadata'
import { getMetadataAndCache } from '@keenondrums/metadata-utils'

class Parent {}
Reflect.defineMetadata('key', 'value', Parent)

Reflect.getOwnMetadata('key', Parent) // returns 'value'
getMetadataAndCache('key', Parent) // returns 'value', basically calls Reflect.getOwnMetadata under the hood and does nothing else in this case

class Child extends Parent {}

Reflect.getOwnMetadata('key', Child) // returns `undefined` as Child doesn't have any own metadata for 'key'
getMetadataAndCache('key', Child) // returns 'value' from Parent and set it as own metadata
Reflect.getOwnMetadata('key', Child) // now it returns 'value'

Keywords

FAQs

Package last updated on 30 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc