UNPKG

@eddaic/nestjs-decorators

Version:

Additional decorators intended for use with NestJS framework.

24 lines (23 loc) 689 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.toLower = toLower; exports.ToLower = ToLower; const class_transformer_1 = require("class-transformer"); const class_validator_1 = require("class-validator"); function toLower(value) { if ((0, class_validator_1.isString)(value)) { return value.toLowerCase(); } else { return null; } } /** * Removes the leading and trailing white space and line terminator characters from string input. * * Null is returned if the value is not a string. * @returns */ function ToLower(options) { return (0, class_transformer_1.Transform)(({ value }) => toLower(value), options); }