UNPKG

@elsikora/nestjs-crud-automator

Version:

A library for automating the creation of CRUD operations in NestJS.

21 lines (18 loc) 764 B
'use strict'; /** * Generates a formatted error string with the entity name * @param {TErrorStringProperties<T>} properties - The error string configuration options * @returns {string} The formatted error string with entity name substituted * @template T - The entity type */ function ErrorString(properties) { const entityName = properties.entity.name === undefined ? "UNKNOWN_RESOURCE" : properties.entity.name.toUpperCase(); if ("property" in properties) { return `${entityName}_${properties.type.replace("{property}", properties.property.toUpperCase())}`; } else { return String(properties.type).replace("{entity}", entityName); } } exports.ErrorString = ErrorString; //# sourceMappingURL=error-string.utility.js.map