UNPKG

custom-automapper

Version:

A powerful, type-safe object mapping library for TypeScript and NestJS

20 lines 691 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AutoMapInterceptor = void 0; const operators_1 = require("rxjs/operators"); class AutoMapInterceptor { constructor(mapper, destination) { this.mapper = mapper; this.destination = destination; } intercept(_context, next) { return next.handle().pipe((0, operators_1.map)(data => { if (Array.isArray(data)) { return this.mapper.mapArray(data, this.destination); } return this.mapper.map(data, this.destination); })); } } exports.AutoMapInterceptor = AutoMapInterceptor; //# sourceMappingURL=interceptor.js.map