UNPKG

@apizr-io/class-utils

Version:

Package containing all class-validator function with all custom apizr class validation functions

21 lines 837 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getTypeName = exports.getTypesName = void 0; const getTypesName = (types, isArray = false) => { const stringTypes = types.map((el) => (0, exports.getTypeName)(el)).join(' | '); const fullStringTypes = isArray && types.length > 1 ? `(${stringTypes})` : stringTypes; return isArray ? `${fullStringTypes}[]` : fullStringTypes; }; exports.getTypesName = getTypesName; const getTypeName = (type) => { if (typeof type === 'object') { const types = Array.isArray(type.type) ? type.type : [type.type]; return (0, exports.getTypesName)(types, type.array); } else if (typeof type === 'string') { return type; } return type.name; }; exports.getTypeName = getTypeName; //# sourceMappingURL=types.utils.js.map