| Server IP : 189.126.111.107 / Your IP : 216.73.217.69 Web Server : Apache System : Linux www.gadotticar.com.br 5.4.0-135-generic #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022 x86_64 User : gadotticar ( 1000) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/gadotticar/frete-api/node_modules/@nestjs/common/pipes/ |
Upload File : |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefaultValuePipe = void 0;
const tslib_1 = require("tslib");
const injectable_decorator_1 = require("../decorators/core/injectable.decorator");
const shared_utils_1 = require("../utils/shared.utils");
/**
* Defines the built-in DefaultValue Pipe
*
* @see [Built-in Pipes](https://docs.nestjs.com/pipes#built-in-pipes)
*
* @publicApi
*/
let DefaultValuePipe = class DefaultValuePipe {
constructor(defaultValue) {
this.defaultValue = defaultValue;
}
transform(value, _metadata) {
if ((0, shared_utils_1.isNil)(value) ||
((0, shared_utils_1.isNumber)(value) && isNaN(value))) {
return this.defaultValue;
}
return value;
}
};
exports.DefaultValuePipe = DefaultValuePipe;
exports.DefaultValuePipe = DefaultValuePipe = tslib_1.__decorate([
(0, injectable_decorator_1.Injectable)(),
tslib_1.__metadata("design:paramtypes", [Object])
], DefaultValuePipe);