UNPKG

@ilhamtahir/ts-mapper

Version:

[![npm version](https://img.shields.io/npm/v/@ilhamtahir/ts-mapper.svg)](https://www.npmjs.com/package/@ilhamtahir/ts-mapper) [![npm downloads](https://img.shields.io/npm/dm/@ilhamtahir/ts-mapper.svg)](https://www.npmjs.com/package/@ilhamtahir/ts-mapper)

29 lines 907 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.metadataStorage = void 0; class MetadataStorage { constructor() { this.mappers = new Map(); } registerMapper(mapper) { if (!this.mappers.has(mapper)) { this.mappers.set(mapper, { methods: {} }); } } registerMapping(mapper, method, option) { if (!this.mappers.has(mapper)) this.registerMapper(mapper); const meta = this.mappers.get(mapper); if (!meta.methods[method]) meta.methods[method] = []; meta.methods[method].push(option); } getMappings(mapper, method) { return this.mappers.get(mapper)?.methods[method] || []; } getAllMappers() { return Array.from(this.mappers.keys()); } } exports.metadataStorage = new MetadataStorage(); //# sourceMappingURL=metadata.storage.js.map