@ganuz/get-metadata-keys
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

@ganuz/get-metadata-keys

Source Code Version MIT License Bundle Size TypeScript

Get Metadata Keys is package from Ganuz library

Install

$ yarn add @ganuz/get-metadata-keys

Or

$ npm install --save @ganuz/get-metadata-keys

Use

Module

import {
  default as getMetadataKeys
} from '@ganuz/get-metadata-keys';

Browser

<script src="https://unpkg.com/@ganuz/get-metadata-keys/bundle.umd.min.js"></script>
let {
  getMetadataKeys
} = G;

Examples

 getMetadataKeys('foo'); // throw TypeError
 getMetadataKeys({}, Symbol('some')); // => []
 getMetadataKeys(class {}); // => []
 let a = {};
 let b = Object.setPrototypeOf({}, a);

 defineMetadata('foo', 'bar', a);
 defineMetadata(Function, Object, a);
 defineMetadata(false, 'no', a, 'prop');

 getMetadataKeys(a); => ['foo', Function]
 getMetadataKeys(a, 'prop'); => [false]

 defineMetadata('foo', 'bob', b);
 defineMetadata(Symbol('color'), 'red', b);
 defineMetadata(0, null, b, 'prop');
 defineMetadata(NaN, false, b, 'prop');

 getMetadataKeys(b); => ['foo', Function, Symbol('color')]
 getMetadataKeys(b, 'prop'); => [false, 0, NaN]

Note: It is based on es6 WeakMap and Map no need for polyfill (built-in library support).

License

Copyright © Yisrael Eliev, Licensed under the MIT license.

Package Sidebar

Install

npm i @ganuz/get-metadata-keys

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

148 kB

Total Files

15

Last publish

Collaborators

  • yisraelx