@elsikora/nestjs-crud-automator
Version:
A library for automating the creation of CRUD operations in NestJS.
32 lines (28 loc) • 1.37 kB
JavaScript
;
var defaultStringFormat_constant = require('../../../constant/interface/api/property/default-string-format.constant.js');
var cloneDeep = require('lodash/cloneDeep');
/**
* Returns default format properties for supported string types (EMAIL, IP, URL, UUID).
* This utility provides standard validation rules including pattern, length constraints,
* example values and descriptions for common string formats.
* @param {TApiPropertyDefaultStringFormat} format - The string format type (EMAIL, IP, URL, or UUID)
* @returns {TApiPropertyDefaultStringFormatProperties} Default properties for the specified format
* @example
* ```typescript
* const emailDefaults = GetDefaultStringFormatProperties(TApiPropertyDefaultStringFormat.EMAIL);
* // Returns:
* // {
* // description: "email",
* // exampleValue: "user@example.com",
* // maxLength: 321,
* // minLength: 5,
* // pattern: "/^([a-zA-Z0-9_\\-.+])+@([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}$/"
* // }
* ```
*/
function GetDefaultStringFormatProperties(format) {
const properties = defaultStringFormat_constant.DEFAULT_STRING_FORMAT_PROPERTY_API_INTERFACE_CONSTANT.DEFAULT_FORMAT_PROPERTIES[format];
return cloneDeep(properties);
}
exports.GetDefaultStringFormatProperties = GetDefaultStringFormatProperties;
//# sourceMappingURL=get-default-string-format-properties.utility.js.map