0.1.1 • Published 5 years ago
@ganuz/has-metadata v0.1.1
@ganuz/has-metadata
Has Metadata is package from Ganuz library
Install
$ yarn add @ganuz/has-metadata
Or
$ npm install --save @ganuz/has-metadata
Use
Module
import {
default as hasMetadata
} from '@ganuz/has-metadata';
Browser
<script src="https://unpkg.com/@ganuz/has-metadata/bundle.umd.min.js"></script>
let {
hasMetadata
} = G;
Examples
hasMetadata('foo', null); // throw TypeError
hasMetadata('foo', {}); // => false
class C{ @Metadata(String, 'cool') [Symbol.for('some')]: string; }
hasMetadata(String, C.prototype, Symbol.for('some')); // => true
class Some{}
defineMetadata('foo', 'bar', Some);
hasMetadata('foo', Some); // => true
class Other extends Some {}
hasMetadata('foo', Other); // => true
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.