UNPKG

node-web-mvc

Version:
45 lines (44 loc) 1.72 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.emptyOf = exports.isMultipartFiles = exports.getVariableName = exports.isSimpleValueType = exports.equalsIgnoreCase = exports.isEmpty = void 0; const MultipartFile_1 = __importDefault(require("../http/MultipartFile")); const isEmpty = (v) => v === undefined || v === null || v === ''; exports.isEmpty = isEmpty; const equalsIgnoreCase = (v1, v2) => { if (v1 === v2) { return true; } return String(v1).toLowerCase() == String(v2).toLowerCase(); }; exports.equalsIgnoreCase = equalsIgnoreCase; const isSimpleValueType = (type) => { return (type === undefined || type === null || Number.isNaN(type) || type === Number || type == String || type === Date || type == URL || type == Boolean || type == RegExp || type == BigInt || type == Math); }; exports.isSimpleValueType = isSimpleValueType; const getVariableName = (type) => { const beanName = String(type === null || type === void 0 ? void 0 : type.name); return beanName.slice(0, 1).toLowerCase() + beanName.slice(1, beanName.length); }; exports.getVariableName = getVariableName; const isMultipartFiles = (value) => { const v = value instanceof Array ? value : [value]; return v.find((m) => !(m instanceof MultipartFile_1.default)) == null; }; exports.isMultipartFiles = isMultipartFiles; const emptyOf = (value, defaultValue) => { return (0, exports.isEmpty)(value) ? defaultValue : value; }; exports.emptyOf = emptyOf;