UNPKG

@dolittle/sdk.common

Version:

Dolittle is a decentralized, distributed, event-driven microservice platform built to harness the power of events.

23 lines 1.78 kB
"use strict"; // Copyright (c) Dolittle. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. Object.defineProperty(exports, "__esModule", { value: true }); exports.getDecoratorMetadata = void 0; const decoratorMetadataMap_1 = require("./decoratorMetadataMap"); /** * Gets the named data in the metadata of the specified type. * @param {string} name - The metadata name to get. * @param {Constructor<any>} type - The type to get metadata on. * @param {boolean} [createMetadata] - An optional boolean to specify whether or not to create the metadata map if it doesn't exist. * @returns {T | undefined} The value of the named data. * @template T The Type of the metadata value. */ function getDecoratorMetadata(name, type, createMetadata) { if (createMetadata === false && !(0, decoratorMetadataMap_1.hasDecoratorMetadataMap)(type)) { return undefined; } const metadata = (0, decoratorMetadataMap_1.ensureDecoratorMetadataMap)(type); return metadata.get(name); } exports.getDecoratorMetadata = getDecoratorMetadata; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0RGVjb3JhdG9yTWV0YWRhdGEuanMiLCJzb3VyY2VSb290IjoiLi4vIiwic291cmNlcyI6WyJEZWNvcmF0b3JzL2dldERlY29yYXRvck1ldGFkYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSwrQ0FBK0M7QUFDL0MscUdBQXFHOzs7QUFJckcsaUVBQTZGO0FBRTdGOzs7Ozs7O0dBT0c7QUFDSCxTQUFnQixvQkFBb0IsQ0FBSSxJQUFZLEVBQUUsSUFBc0IsRUFBRSxjQUF3QjtJQUNsRyxJQUFJLGNBQWMsS0FBSyxLQUFLLElBQUksQ0FBQyxJQUFBLDhDQUF1QixFQUFDLElBQUksQ0FBQyxFQUFFO1FBQzVELE9BQU8sU0FBUyxDQUFDO0tBQ3BCO0lBRUQsTUFBTSxRQUFRLEdBQUcsSUFBQSxpREFBMEIsRUFBQyxJQUFJLENBQUMsQ0FBQztJQUNsRCxPQUFPLFFBQVEsQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLENBQUM7QUFDOUIsQ0FBQztBQVBELG9EQU9DIn0=