@trapi/metadata
Version:
Generate REST-API metadata scheme from TypeScript Decorators.
130 lines • 4.91 kB
JavaScript
;
/*
* Copyright (c) 2021.
* Author Peter Placzek (tada5hi)
* For the full copyright and license information,
* view the LICENSE file that was distributed with this source code.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.isPrimitiveType = exports.isReferenceType = exports.isRefAliasType = exports.isRefObjectType = exports.isRefEnumType = exports.isUnionType = exports.isIntersectionType = exports.isNestedObjectLiteralType = exports.isArrayType = exports.isEnumType = exports.isObjectType = exports.isByteType = exports.isBufferType = exports.isBinaryType = exports.isDateTimeType = exports.isFileType = exports.isDateType = exports.isVoidType = exports.isLongType = exports.isIntegerType = exports.isFloatType = exports.isDoubleType = exports.isBooleanType = exports.isStringType = exports.isUndefinedType = exports.isAnyType = void 0;
const constants_1 = require("./constants");
function isAnyType(param) {
return param.typeName === constants_1.TypeName.ANY;
}
exports.isAnyType = isAnyType;
function isUndefinedType(param) {
return param.typeName === constants_1.TypeName.UNDEFINED;
}
exports.isUndefinedType = isUndefinedType;
function isStringType(param) {
return param.typeName === constants_1.TypeName.STRING;
}
exports.isStringType = isStringType;
function isBooleanType(param) {
return param.typeName === constants_1.TypeName.BOOLEAN;
}
exports.isBooleanType = isBooleanType;
function isDoubleType(param) {
return param.typeName === constants_1.TypeName.DOUBLE;
}
exports.isDoubleType = isDoubleType;
function isFloatType(param) {
return param.typeName === constants_1.TypeName.FLOAT;
}
exports.isFloatType = isFloatType;
function isIntegerType(param) {
return param.typeName === constants_1.TypeName.INTEGER;
}
exports.isIntegerType = isIntegerType;
function isLongType(param) {
return param.typeName === constants_1.TypeName.LONG;
}
exports.isLongType = isLongType;
function isVoidType(param) {
return typeof param === 'undefined' || param.typeName === constants_1.TypeName.VOID;
}
exports.isVoidType = isVoidType;
function isDateType(param) {
return param.typeName === constants_1.TypeName.DATE;
}
exports.isDateType = isDateType;
function isFileType(param) {
return param.typeName === constants_1.TypeName.FILE;
}
exports.isFileType = isFileType;
function isDateTimeType(param) {
return param.typeName === constants_1.TypeName.DATETIME;
}
exports.isDateTimeType = isDateTimeType;
function isBinaryType(param) {
return param.typeName === constants_1.TypeName.BINARY;
}
exports.isBinaryType = isBinaryType;
function isBufferType(param) {
return param.typeName === constants_1.TypeName.BUFFER;
}
exports.isBufferType = isBufferType;
function isByteType(param) {
return param.typeName === constants_1.TypeName.BYTE;
}
exports.isByteType = isByteType;
function isObjectType(param) {
return param.typeName === constants_1.TypeName.OBJECT;
}
exports.isObjectType = isObjectType;
function isEnumType(param) {
return param.typeName === constants_1.TypeName.ENUM;
}
exports.isEnumType = isEnumType;
function isArrayType(param) {
return param.typeName === constants_1.TypeName.ARRAY;
}
exports.isArrayType = isArrayType;
function isNestedObjectLiteralType(param) {
return param.typeName === constants_1.TypeName.NESTED_OBJECT_LITERAL;
}
exports.isNestedObjectLiteralType = isNestedObjectLiteralType;
function isIntersectionType(param) {
return param.typeName === constants_1.TypeName.INTERSECTION;
}
exports.isIntersectionType = isIntersectionType;
function isUnionType(param) {
return param.typeName === constants_1.TypeName.UNION;
}
exports.isUnionType = isUnionType;
function isRefEnumType(param) {
return param.typeName === constants_1.TypeName.REF_ENUM;
}
exports.isRefEnumType = isRefEnumType;
function isRefObjectType(param) {
return param.typeName === constants_1.TypeName.REF_OBJECT;
}
exports.isRefObjectType = isRefObjectType;
function isRefAliasType(param) {
return param.typeName === constants_1.TypeName.REF_ALIAS;
}
exports.isRefAliasType = isRefAliasType;
function isReferenceType(param) {
return param.typeName === constants_1.TypeName.REF_ALIAS ||
param.typeName === constants_1.TypeName.REF_ENUM ||
param.typeName === constants_1.TypeName.REF_OBJECT;
}
exports.isReferenceType = isReferenceType;
function isPrimitiveType(type) {
return isAnyType(type) ||
isBinaryType(type) ||
isBooleanType(type) ||
isBufferType(type) ||
isByteType(type) ||
isDateType(type) ||
isDateTimeType(type) ||
isDoubleType(type) ||
isFloatType(type) ||
isFileType(type) ||
isIntegerType(type) ||
isLongType(type) ||
isObjectType(type) ||
isStringType(type);
}
exports.isPrimitiveType = isPrimitiveType;
//# sourceMappingURL=type.js.map